- What Laravel versions does baks-dev/products-category support?
- The package is officially tested on Laravel 7.4.x and requires PHP 8.4+. While it may work on newer Laravel 8.x/9.x versions, compatibility isn’t guaranteed without testing. Always verify with `composer why-not` before installation.
- How do I install assets and configure cover image uploads?
- Run `php bin/console baks:assets:install` to set up assets, then manually create the upload directory with `mkdir public/upload/product_category_cover` and set permissions to `773`. The package assumes local storage by default, so S3 or cloud integrations require custom configuration.
- Does this package support hierarchical (nested) categories?
- Yes, the package is designed for nested category structures, ideal for e-commerce or inventory systems. However, deep nesting may require manual optimizations (e.g., eager-loading) to avoid N+1 query issues. No built-in support for circular references exists.
- Can I use Eloquent instead of Doctrine ORM?
- No, this package relies on Doctrine DBAL for database operations. If your project uses Eloquent exclusively, you’ll need to refactor or fork the package to replace Doctrine dependencies, which may introduce compatibility risks.
- How do I handle multilingual category names?
- The package lacks built-in i18n support. You’ll need to implement a custom solution (e.g., Laravel Localization or a separate translation table) alongside the existing category schema. No official localization hooks or middleware are provided.
- What if my project already has a categories table?
- High risk of schema conflicts. Run `php bin/console doctrine:migrations:diff` in a staging environment first to compare tables. The package’s migrations may overwrite or duplicate existing category-related tables. Manual merging is often required.
- Are there any alternatives for Laravel product categories?
- Yes, consider `spatie/laravel-medialibrary` (for media) + `spatie/laravel-activitylog` (for auditing) paired with Eloquent models, or `orchid/platform` for a full-featured admin panel with taxonomy support. This package is niche due to its Doctrine dependency.
- How do I test the package before production?
- Run `php bin/phpunit --group=products-category` for unit tests, then manually test migrations in a staging environment. Simulate edge cases like deep nesting, concurrent uploads, and permission errors to validate stability.
- Can I customize cover image validation or storage?
- Yes, override default behaviors via Laravel’s service container bindings. For storage, replace the `filesystem` binding in the service provider. Validation rules can be extended using Laravel’s form requests or custom validation logic.
- What are the performance implications for large category trees?
- Nested queries may suffer from N+1 issues without proper indexing or eager-loading. Test with `DB::enableQueryLog()` to identify bottlenecks. Consider adding composite indexes on `parent_id` and `slug` columns if using deep hierarchies.