- How do I install `baks-dev/materials-catalog` in a Laravel project?
- Run `composer require baks-dev/materials-category baks-dev/materials-catalog` to install both required packages. Ensure your Laravel project uses PHP 8.4+ and Laravel 10+ for compatibility. The package includes a Symfony bundle structure, so manual service binding may be needed for Laravel’s DI container.
- Does this package support Laravel’s Eloquent ORM, or is it Doctrine-only?
- The package uses Doctrine ORM by default, which requires integration work with Laravel’s Eloquent. You’ll need to either fork and convert models or implement a schema adapter to translate Doctrine queries to Eloquent. Schema collisions (e.g., table names) are a known risk.
- Can I use this package in Laravel without Symfony’s EventDispatcher?
- Yes, but you’ll need to bridge Symfony’s `EventDispatcherInterface` with Laravel’s event system. Options include creating a dual-event dispatcher or using Laravel’s bus to forward Symfony events. The package’s core business logic (e.g., material validation) should remain decoupled from Symfony dependencies.
- Are migrations included, or do I need to manually create database tables?
- The package does not provide Laravel migrations out-of-the-box. You’ll need to either manually create tables or use Doctrine migrations, which may introduce schema conflicts. Consider exposing Symfony tables via Laravel views or treating the package as a microservice for decoupling.
- How does authentication/authorization work with Laravel’s Sanctum or Passport?
- The package lacks native integration with Laravel’s Gates, Policies, or Sanctum/Passport. You’ll need to implement custom middleware or relay API tokens between systems. Symfony’s security component (e.g., voters) won’t map directly to Laravel’s authorization layers.
- Does this package offer a RESTful API or GraphQL layer for Laravel to consume?
- The package does not include a built-in RESTful API or GraphQL layer. Data access will require either direct database queries (via views or adapters) or treating the package as a microservice with API endpoints. Symfony Messenger or Laravel queues could bridge event-driven communication.
- Are there Laravel-specific tests, or are the PHPUnit tests Symfony-focused?
- The existing PHPUnit tests are Symfony-focused, covering the bundle’s core functionality. For Laravel integration, you’ll need to add tests for HTTP routes, API responses, and jobs. The `--group=materials-catalog` test group targets Symfony-specific logic.
- What Laravel versions are officially supported by this package?
- While the package requires PHP 8.4+, it is not explicitly tested for Laravel versions beyond 10+. The Symfony bundle structure introduces compatibility risks, so test thoroughly in your Laravel environment. Laravel 11+ may face additional challenges due to evolving DI container changes.
- Can I extend the package (e.g., add custom material attributes) without forking?
- Extensibility depends on the package’s documented hooks, which may be limited due to its Symfony origins. Check for events, services, or config files in the README or source code. If no clear extension points exist, you may need to subclass or override core classes.
- What are the performance implications of using Doctrine in a Laravel app?
- Doctrine’s query builder and lazy loading may introduce N+1 query risks or caching complexities when mixed with Laravel’s Eloquent. Profile performance early, especially for bulk operations. Consider caching layers (e.g., Redis) or query optimization tools like Laravel Debugbar.