nyoncode/laravel-package-console
Artisan-like generators and scaffolding for developing Laravel 12 and 13 packages, with first-class laravel-package-toolkit support
1,120
| Install | |
|---|---|
composer require nyoncode/laravel-package-console |
|
| Latest Version: | 1.2.0 |
| PHP: | ^8.2 |
| License: | MIT |
| Last Updated: | Nov 13, 2026 |
| Links: | GitHub · Packagist |
Maintainer: NyonCode
Anvil: an Artisan-like console for Laravel packages
Anvil is php artisan make:* for people who build Laravel packages. It supports Laravel 12 and 13.
php anvil make:model Post -a
INFO Model [src/Models/Post.php] created successfully.
INFO Factory [database/factories/PostFactory.php] created successfully.
INFO Migration [database/migrations/create_posts_table.php] created successfully.
DONE Registered ->hasMigrations() in src/BlogServiceProvider.php.
INFO Seeder [database/seeders/PostSeeder.php] created successfully.
DONE Registered ->hasSeeders() in src/BlogServiceProvider.php.
INFO Controller [src/Http/Controllers/PostController.php] created successfully.
INFO Policy [src/Policies/PostPolicy.php] created successfully.
package:initcreates or completescomposer.jsonand scaffolds the package:- a service provider and a config file;
- Pest + Testbench, Larastan and Pint;
- a GitHub Actions matrix for PHP × Laravel.
- 34
make:*commands write each file in your package's namespace and register it in your service provider:- with laravel-package-toolkit, as
->hasX()calls inconfigure(); - with spatie/laravel-package-tools, as
->hasX()calls inconfigurePackage(); - with a plain Laravel
ServiceProvider, as the standard calls inregister()/boot().
- with laravel-package-toolkit, as
- Works with existing packages.
package:initcompletescomposer.jsonand keeps your provider, test setup and CI.package:doctorthen finds the files your provider does not register, and registrations of files that are gone, and--fixregisters what is missing. - Asks instead of failing. In a terminal, a generator without a name asks for it and for
its options, with Laravel Prompts, in English or Czech. With
--no-interactionnothing is ever asked. - Registration is idempotent. It only adds what is missing and never reformats your code.
- Every generated file passes Pint and Larastan. Integration tests install a generated package on Laravel 12 and 13 and check every registration in a running application.
Installation
composer require --dev nyoncode/laravel-package-console
vendor/bin/anvil package:init
php anvil list
Requires PHP 8.2+.
Documentation
The full documentation is in docs/:
- Installation and Quickstart
- Creating a package
- Service provider registration: exactly what each generator adds, with the toolkit, with spatie/laravel-package-tools and with a plain provider
- Command reference
- Customising stubs
Testing
composer test # unit and feature tests
composer test:integration # installs generated packages on Laravel 12 and 13 (needs network)
See Contributing.
Changelog
See CHANGELOG.
License
The MIT License (MIT). See LICENSE.
Related Packages
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 1.2.0 | ^8.2 | MIT | |
| 1.1.0 | ^8.2 | MIT | |
| 1.0.1 | ^8.2 | MIT | |
| 1.0.0 | ^8.2 | MIT |