Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Categories Laravel Package

escolalms/categories

A Laravel package for managing hierarchical categories with nested tree structures and polymorphic relations. It ships Eloquent models, migrations, and services for creating, moving, and querying categories, letting you attach categorized tagging to any model in your application.

Deep Wiki
Context7

Package for categories and tags managment

Frequently asked questions about Categories
How do I install escolalms/categories in a Laravel application?
Install it with Composer by running composer require escolalms/categories from your project root. Then publish any package assets the service provider requires and run the migrations so the category tables exist. The package ships Eloquent models, migrations, and services, so once the tables are in place you can start creating categories and attaching them to your models.
Does this package support hierarchical or nested categories with parent and child relationships?
Yes. The package is built around hierarchical categories stored as nested tree structures, so a category can have a parent and its own children. Creating, moving, and querying those nodes is handled by the package services, which means you do not have to write your own parent_id traversal logic. This makes it suitable for multi-level menus, taxonomies, and product trees.
How do I attach categories or tags to an existing Eloquent model?
Categorization is polymorphic, so any Eloquent model can be linked to categories without altering its own table. You attach categories through the package's relation and service layer, and the link is stored in a shared pivot table keyed by the related model. That lets several different model types reuse the same category tree.
Which Laravel and PHP versions does escolalms/categories support?
The supported versions are defined in the package composer.json require section, so check the php and illuminate/support constraints there before installing. That file is the authoritative source and may differ between releases. If your application runs an older Laravel release, verify the constraint before adding the dependency to avoid a Composer conflict.
Do I need to publish and run the package migrations, and what do they create?
The package ships migrations, so publish them if your version of the service provider does not load them automatically, then run php artisan migrate. Those tables hold the category tree and the polymorphic pivot used to attach categories to your models. Review the published files before running them against an existing production database so you know exactly which tables and indexes are added.
How do I move a category to a different parent or reorder the tree?
Use the package services to reparent or reposition a category instead of updating parent IDs by hand. Routing moves through the service keeps the nested structure consistent for descendants and for anything querying the hierarchy. If you are moving several nodes at once, wrap the operation in a database transaction.
Can a single model belong to multiple categories at once?
Yes. Because the relation is polymorphic, one model can be attached to several categories, and the same category can be shared by many different model types. Attachments live in a pivot table rather than a column on your own tables, so no schema change is needed on the model being categorized. This is what allows categorized tagging across unrelated parts of an application.
How do I query a category together with its descendants or ancestors efficiently?
Query through the package models and services, which understand the nested structure, rather than writing raw recursive SQL. For deep trees, prefer a single scoped query or eager loading over looping per node to avoid N+1 queries. If you expect very large trees, check whether the shipped migrations store depth or path data you can filter on.
How can I test category behavior in my own test suite?
Run the package's own suite using the Composer scripts defined in the repository, then write feature tests against an in-memory SQLite database using RefreshDatabase. Load or publish the package migrations in your test bootstrap so the category tables exist before assertions run. Keep tests focused on parent and child relationships, move operations, and polymorphic attachments, since those are the parts most likely to break.
Is escolalms/categories production ready, and how does it compare to nested set or tagging packages?
The package is focused specifically on hierarchical categories plus categorized tagging through polymorphic and nested tree relations. Alternatives such as kalnoy/nestedset or spatie/laravel-tags overlap in places, so compare migration footprint, API surface, and how each handles moves before committing. Before going to production, review the migrations, back up existing data, and confirm how moving a node affects models already attached to it.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect