PHPackages                             wsmallnews/category - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wsmallnews/category

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wsmallnews/category
===================

Wsmallnews system classify/category modules

v1.0.10(1w ago)013[1 PRs](https://github.com/Wsmallnews/category/pulls)MITPHPPHP ^8.2CI passing

Since Nov 1Pushed 3w ago1 watchersCompare

[ Source](https://github.com/Wsmallnews/category)[ Packagist](https://packagist.org/packages/wsmallnews/category)[ Docs](https://github.com/wsmallnews/category)[ GitHub Sponsors](https://github.com/Wsmallnews)[ RSS](/packages/wsmallnews-category/feed)WikiDiscussions v1 Synced today

READMEChangelog (10)Dependencies (78)Versions (18)Used By (0)

Wsmallnews system classify/category modules
===========================================

[](#wsmallnews-system-classifycategory-modules)

[![Latest Version on Packagist](https://camo.githubusercontent.com/34280782f42cd3bb5e57dd616c32dfd72bb279f9cfe849083482a2e362823f46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77736d616c6c6e6577732f63617465676f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wsmallnews/category)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f1d21efbd878b1131e62a8c80d6060b72b9a7d0caeb543bf525f8ad94e9fff74/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f77736d616c6c6e6577732f63617465676f72792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/wsmallnews/category/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/952f0efa697b3308d5ddf8300ac2c0353020740d84b6f5e41cac87a006c64129/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f77736d616c6c6e6577732f63617465676f72792f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/wsmallnews/category/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c36685335b0b7cf3a9b1f2b52d5fe56e0cd8ccad36198ef4f272122b3be4bf5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77736d616c6c6e6577732f63617465676f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wsmallnews/category)

`wsmallnews/category` is a Filament category management package built on `wsmallnews/filament-nestedset`. It provides hierarchical categories, category type management, scopeable data, and optional Filament tenancy support.

Features
--------

[](#features)

- Category tree management powered by `kalnoy/nestedset` through `wsmallnews/filament-nestedset`
- Category type records for separating different category trees
- Scopeable category data via `scope_type` and `scope_id`
- Automatic tenant scoping when the current Filament panel supports tenancy
- Filament plugin registration for category pages and category type resources
- Frontend Livewire category tree component

AI Guidelines
-------------

[](#ai-guidelines)

This package ships Laravel Boost AI Guidelines in `resources/boost/guidelines/core.blade.php`.

Install or enable Laravel Boost in your application, then refresh Boost resources so this package's guidelines are discovered and added to the project overview:

```
php artisan boost:update --discover
```

Boost updates the root `boost.json` and `CLAUDE.md` automatically. Check those files after running the command to confirm `wsmallnews/category` is included.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require wsmallnews/category
```

The package provides an install command. By default it also installs its support dependency:

```
php artisan sn-category:install
```

To skip dependency installation and interactive prompts:

```
php artisan sn-category:install --no-deps --no-interaction
```

You can publish and run only the migrations with:

```
php artisan vendor:publish --tag="category-migrations"
php artisan migrate
```

You can publish only the config file with:

```
php artisan vendor:publish --tag="category-config"
```

Optionally, you can publish the views using:

```
php artisan vendor:publish --tag="category-views"
```

Configuration
-------------

[](#configuration)

The package configuration lives in `config/sn-category.php`:

```
return [
    'scopeable' => [
        'scope_type' => 'sn-category',
        'scope_id' => 0,
    ],

    'models' => [
        'category' => Wsmallnews\Category\Models\Category::class,
        'category_type' => Wsmallnews\Category\Models\CategoryType::class,
    ],

    'panel_register' => [
        'pages' => [
            Wsmallnews\Category\Filament\Pages\Category\CategoryPage::class,
        ],
        'resources' => [
            Wsmallnews\Category\Filament\Resources\CategoryTypes\CategoryTypeResource::class,
        ],
    ],
];
```

Filament plugin
---------------

[](#filament-plugin)

Register the plugin on your Filament panel:

```
use Wsmallnews\Category\CategoryPlugin;

$panel
    ->plugin(CategoryPlugin::make());
```

`CategoryPlugin` registers the pages and resources configured in `sn-category.panel_register`:

- `Wsmallnews\Category\Filament\Pages\Category\CategoryPage`
- `Wsmallnews\Category\Filament\Resources\CategoryTypes\CategoryTypeResource`

Usage
-----

[](#usage)

### Category page

[](#category-page)

`CategoryPage` extends `Wsmallnews\Category\Filament\Pages\Category\Base`, which extends `Wsmallnews\FilamentNestedset\Filament\Pages\NestedsetPage`.

The base page automatically resolves or creates a `CategoryType` for the configured scope, applies the type's level to the nestedset tree, and scopes category records by:

- `scope_type`
- `scope_id`
- `type_id`
- `team_id` when tenancy is enabled

### Custom category page

[](#custom-category-page)

Create your own page by extending the base page:

```
