Installation
Via Composer
Requires PHP 8.1+ and Laravel 10 to 13.
You may install Next Laravel into your Laravel application by running the following command.
composer require laranex/next-laravelThe NextLaravelServiceProvider and the NextLaravel facade alias are registered automatically through package discovery. Publishing the config, views or stubs is optional, see Configuration.
Commands
The package registers one generator command per unit. Every unit except routes is generated inside a module.
| Command | Generates |
|---|---|
next:route {route} {versionOrDirectory?} [--api] [--force] | routes/{web|api}/[versionOrDirectory/]{routes}.php |
next:controller {controller} {module} [--force] | app/Modules/{Module}Module/Http/Controllers/{Name}Controller.php |
next:request {request} {module} [--force] | app/Modules/{Module}Module/Http/Requests/{Name}Request.php |
next:feature {feature} {module} [--force] | app/Modules/{Module}Module/Features/{Name}Feature.php |
next:operation {operation} {module} [--force] | app/Modules/{Module}Module/Operations/{Name}Operation.php |
next:job {job} {module} [--queue] [--force] | app/Modules/{Module}Module/Jobs/{Name}Job.php |
Each command exits with 0 when the file is generated and 1 when generation fails, for example when the file already exists and --force was not given, or when a name contains / or \ (nested names such as Blog/CreatePost are not supported).
Facade
The NextLaravel facade exposes the helper the service provider uses to discover route files.
use Laranex\NextLaravel\Facades\NextLaravel;
// Every .php file under routes/api, recursively, as absolute paths,
// in sorted order
$files = NextLaravel::getAllFilesOfADirectory(base_path('routes/api'), 'php');getAllFilesOfADirectory(string $directory, string $extension = '') returns an empty array when the directory does not exist, and every file when $extension is empty.