centrust/nova-modules

Nova Modular Architrchter

Maintainers

Package info

github.com/centrust/nova-modules

pkg:composer/centrust/nova-modules

Statistics

Installs: 25

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.2 2026-02-26 18:41 UTC

This package is auto-updated.

Last update: 2026-02-26 18:43:40 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

This command will ask for the module name 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

Prompts for: Module name, Resource name, and Model name.

Create an Action

php artisan module:action

Prompts for: Module name and Action name.

Create a Policy

php artisan module:policy

Prompts for: 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

Prompts for: 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

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.