- Can I use RadBundle in Laravel, or is it strictly for Symfony?
- RadBundle is designed for Symfony and relies on its ServiceContainer, Doctrine ORM, and EventDispatcher. While you could integrate it via Symfony/DependencyInjection or build an adapter layer, Laravel’s Eloquent and native IoC make this high-effort. Focus on features like ApiResponse for API normalization instead.
- What Laravel alternatives exist for RadBundle’s API response normalization?
- For API response normalization, consider spatie/laravel-api-resources or laravel-breeze. These are Laravel-native and avoid Symfony dependencies. RadBundle’s ApiResponse could still be used selectively if you standardize JSON responses across your app.
- How do I migrate from Laravel’s Response helpers to RadBundle’s ApiResponse?
- Replace `return response()->json($data)` with `return ApiResponse::create($data)->json()`. Start with critical endpoints to test compatibility. Use a facade or alias for easier transition. Document the change in your API contracts.
- Does RadBundle support Laravel’s Eloquent ORM, or is Doctrine required?
- RadBundle assumes Doctrine ORM, so features like DoctrineChangeChecker won’t work with Eloquent. For entity logic, extend Eloquent models with RadBundle’s EntityModel traits (e.g., `persist()`, `refresh()`) while avoiding Doctrine-specific methods.
- What’s the best way to test RadBundle in a Laravel project?
- Mock Symfony dependencies (e.g., ServiceContainer) using PHPUnit or Pest. For Eloquent-integrated features, test traits directly on models. Avoid testing Doctrine-specific logic unless you’re using both ORMs. Use Laravel’s built-in testing tools for API responses.
- How does AbilitiesVoter compare to Laravel’s gates/policies?
- AbilitiesVoter uses attribute-based authorization (e.g., `@Abilities([User::CAN_EDIT])`), similar to Laravel’s gates but more opinionated. To adapt it, create a Laravel gate/policy wrapper or use it alongside existing policies for consistency.
- Will RadBundle work with Laravel 10+ and PHP 8.3+?
- RadBundle requires Symfony 6.2+ and PHP 8.3+, which may conflict with Laravel’s ecosystem. If you’re on Laravel 10+, focus on features like ApiResponse that don’t depend on Symfony. For Doctrine/ORM features, avoid or rewrite them for Eloquent.
- Can I use RadBundle’s ImportData for bulk operations in Laravel?
- Yes, but replace Doctrine-specific logic with Eloquent’s `Model::insert()` or `Collection::each()`. ImportData’s ValueObject structure can still be used for data validation and transformation, making it a lightweight alternative to Laravel’s bulk helpers.
- What’s the maintenance overhead of using RadBundle in Laravel?
- High if you rely on Symfony dependencies. Plan for manual updates to workarounds (e.g., mocking the container) and potential breaking changes when RadBundle aligns with Symfony 7+. Document deviations from Laravel conventions to ease future refactoring.
- How do I selectively adopt RadBundle features without full integration?
- Prioritize Symfony-independent features like ApiResponse or ImportData. For Doctrine-dependent tools, build thin adapters or skip them. Use composer’s `require-dev` to test features in isolation before full adoption.