Search by

centrust / nova-modules

centrust

Nova Modular Architrchter

Package info

github.com/centrust/nova-modules

pkg:composer/centrust/nova-modules

Statistics

Installs: 143

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.5 2026-10-12 07:39 UTC

This package is auto-updated.

Last update: 2026-10-12 07:41:25 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a modular architecture for Laravel Nova, allowing you to organize your Nova resources, actions, policies, and more into dedicated modules. It helps keep your app/Nova directory clean and improves code maintainability by grouping related functionality.

Installation

You can install the package via composer:

composer require centrust/nova-modules

You can publish the config file with:

php artisan vendor:publish --tag="nova-modules-config"

Module Architecture

The package organizes modules under the app/Nova/Modules directory. Each module has its own subdirectory containing its specific components:

app/Nova/Modules/
└── YourModuleName/
    ├── Actions/
    ├── Enums/
    ├── Filters/
    ├── Lenses/
    ├── Metrics/
    ├── Policies/
    ├── Resources/
    ├── Rules/
    └── Services/

Usage

The package provides several Artisan commands to generate modules and their components.

Create a New Module

To create the directory structure for a new module:

php artisan module:create {name?}

This command will ask for the module name (if not provided) and generate the standard directory structure.

Generate Module Components

You can generate specific components within a module using the following commands:

Create a Resource

php artisan module:resource {module?} {resource?} {model?}

Prompts for (if not provided): Module name, Resource name, and Model name.

Create an Action

php artisan module:action {module?} {action?}

Prompts for (if not provided): Module name and Action name.

Create a Filter

php artisan module:filter {name?} {resource?}

Prompts for (if not provided): Module name and Filter name. Generates a select filter in app/Nova/Modules/{name}/Filters.

Use --boolean or --date to generate a boolean or date filter using its own stub:

php artisan module:filter Sales OrderStatusFilter --boolean
php artisan module:filter Sales CreatedAfterFilter --date

The options cannot be used together. Without either option, the default remains a select filter.

Create a Policy

php artisan module:policy {module?} {policy?} {model?}

Prompts for (if not provided): Module name, Policy name, and Model name. This generates a standard Laravel policy that applies to the Eloquent Model.

Create a Nova Policy

php artisan module:nova-policy {module?} {policy?} {resource?}

Prompts for (if not provided): Module name, Policy name, and Resource class. This generates a Nova-specific policy where the resource itself is passed instead of the Model. This is specifically useful for Nova V5 where policies can be directly applied to resources. Like: public static $policy =nova-policy::class; inside the nova resource

Laravel Boost Skill

This package includes the nova-modules-development skill in resources/boost/skills to help AI agents generate and work with module resources, actions, and policies.

In a consuming application with Laravel Boost installed, run:

php artisan boost:install

Select skills during installation and enable this package's skill when prompted. Boost installs package skills according to your preferences; no additional service provider configuration is needed.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.