- How do I install unisharp/categorizable in a Laravel application?
- Install it with Composer using composer require unisharp/categorizable. The package is designed to fit Laravel's service-provider and package-discovery model, but you should confirm discovery and any config publishing steps for your version. After installation, publish and review the configuration if you need custom category or pivot table names.
- How do I attach categories to an Eloquent model with this package?
- Add the provided categorizable trait to the Eloquent model you want to categorize. The package exposes a polymorphic relationship plus sync helpers for attaching and detaching categories. You can then manage category assignments through those helpers or relationship methods.
- Does unisharp/categorizable support nested or hierarchical categories?
- Yes. The package supports nested categories with a parent and child hierarchy. That lets you organize categories beyond a flat list and query models through category relationships. You can combine this with the package's query scopes when filtering models by category.
- Which Laravel versions does unisharp/categorizable support?
- Release 1.3.2 adds Laravel 6 compatibility, but the terse release note does not confirm whether Laravel 5.x remains supported or whether Laravel 7 and newer are supported. Check the package composer.json for the actual illuminate constraints before adopting it. Treat Laravel 6 as a legacy target because it reached end of security support in September 2022.
- What PHP version do I need for unisharp/categorizable with Laravel 6?
- Laravel 6 requires PHP 7.2 or newer, so your application must meet that baseline. The package's own PHP constraint should be verified in composer.json because the 1.3.2 release note does not document it. Run dependency resolution in staging to catch any mismatch.
- How do I query models by category using unisharp/categorizable?
- The package provides query scopes for filtering by category. Apply the relevant scope to your model query after adding the categorizable trait and attaching categories. This lets you retrieve models assigned to a given category without writing custom joins yourself.
- Can I use unisharp/categorizable with any Eloquent model without changing existing tables?
- Yes. The package is built around a polymorphic trait, so you can add category support to any Eloquent model without schema changes to your existing tables. Category and pivot tables are configurable. This makes it suitable for adding categories to models that already have their own database structure.
- Is unisharp/categorizable safe for production and actively maintained?
- Treat it as a legacy-compatible package rather than a modernization step. Version 1.3.2 adds Laravel 6 support, and Laravel 6 has been end-of-life for security support since September 2022. Pin the version, run tests, and keep a rollback plan before production use.
- How do I configure the category and pivot table names in unisharp/categorizable?
- The package supports configurable category and pivot tables. Publish the package configuration and update the table names to match your database conventions. After changing table names, verify migrations or existing schema assumptions and run your tests.
- What should I check before upgrading to unisharp/categorizable 1.3.2?
- Read composer.json and the changelog to establish the real support matrix, then pin 1.3.2 instead of floating ^1.3. Run composer why-not and the package test suite on your Laravel 6 and PHP version in a staging branch. Verify config publishing and service-provider registration before deploying.