- Can I use astroway/sdk-symfony directly in Laravel, or do I need a workaround?
- No, the bundle is Symfony-specific. You’ll need to manually register the `Astroway` service in Laravel’s `AppServiceProvider` or create a custom wrapper to replicate its DI and config features. The core `astroway/sdk` package can still be used standalone in Laravel.
- How do I configure astroway/sdk in Laravel if I skip the Symfony bundle?
- Use Laravel’s `.env` file for API keys and `config/astroway.php` to define settings like `base_url`, `timeout`, and `auth_scheme`. Bind the `Astroway` service in `AppServiceProvider` using these config values, similar to how the Symfony bundle registers it.
- What Laravel version does this package support, or is it only for Symfony?
- This package is **not** Laravel-compatible by design—it’s built for Symfony 6.4+/7.x. However, the underlying `astroway/sdk` (v0.1.0-alpha.0+) can be used in Laravel with manual setup. No official Laravel version support exists for the Symfony bundle itself.
- Is there a risk of breaking changes since this is in alpha?
- Yes, the bundle is pre-1.0.0 and lacks a stable release. The roadmap includes breaking changes (e.g., compiler passes, Profiler integration) before `0.1.0`. Test thoroughly in a staging environment if evaluating for production. The core `astroway/sdk` may also evolve independently.
- How do I autowire the Astroway service in Laravel without the Symfony bundle?
- Laravel doesn’t support Symfony’s autowiring natively. Instead, bind the service in `AppServiceProvider` with `$this->app->singleton(Astroway::class, fn($app) => new Astroway(config('astroway.api_key'), ...));`. Then use type-hinting in controllers/services as usual.
- Are there Laravel-native alternatives to this bundle for Astroway API integration?
- Yes. For lightweight use, pair `astroway/sdk` with Laravel’s HTTP client or Guzzle. For config management, use Laravel’s `config/astroway.php`. Avoid reinventing the wheel unless you need Symfony-specific features like Profiler integration (which would require custom Laravel Debugbar adapters).
- Will the Symfony bundle’s Profiler integration work with Laravel Debugbar?
- No, the `AstrowayDataCollector` is Symfony Profiler-specific. To replicate this in Laravel, you’d need to create a custom Debugbar subscriber or use Laravel’s built-in logging. The bundle’s roadmap features may not align with Laravel’s tooling without manual adaptation.
- How do I handle API timeouts or auth failures in Laravel with this SDK?
- Configure timeouts and auth schemes in `config/astroway.php` (e.g., `timeout: 30`, `auth_scheme: 'header'`). The `astroway/sdk` handles retries and errors internally, but log exceptions with Laravel’s `Log::error()` for debugging. No Symfony-specific error handlers are included.
- Does this bundle add performance overhead in Laravel if I adapt it?
- Potentially. The Symfony bundle uses compiler passes and decorators, which Laravel’s simpler DI container may not need. If you replicate its features manually (e.g., config loading, service binding), avoid unnecessary complexity. Profile with Laravel’s `bench()` or Blackfire to compare.
- How do I secure API keys in Laravel vs. Symfony’s YAML config?
- Use Laravel’s `.env` file for `ASTROWAY_API_KEY` and restrict access via `config('astroway.api_key')` in code. Symfony’s YAML supports `%env()` placeholders, but Laravel’s `.env` is more secure by default. Never hardcode keys in PHP files or version-controlled configs.