milwad / pcreators
An interactive CLI to scaffold a production-ready PHP/Laravel package in seconds.
Requires
- php: ^8.2
- laravel/prompts: ^0.3
- symfony/console: ^6.4 || ^7.0 || ^8.0
- symfony/filesystem: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- pestphp/pest: ^3.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
An interactive CLI that scaffolds a production-ready PHP/Laravel package in seconds. Answer a few prompts and get a complete, test-passing, CI-ready package skeleton.
$ pcreators
┌ pcreators — scaffold a Laravel package in seconds ────────────┐
┌ Vendor name ─────────────────────────────────────────────────┐
│ acme │
└──────────────────────────────────────────────────────────────┘
...
Requirements
- PHP 8.2+
- Composer
Installation
Install globally so pcreators is available everywhere:
composer global require milwad/pcreators
Make sure your global Composer bin directory is on your PATH
(~/.composer/vendor/bin or ~/.config/composer/vendor/bin).
Or run it from a local clone:
git clone https://github.com/milwad-dev/pcreators.git
cd pcreators
composer install
php bin/pcreators
Usage
# Interactive — creates ./<package-name> pcreators # Generate into a specific directory pcreators packages/my-package
The wizard asks for:
- Vendor and package name (e.g.
acme/blog-manager→acme/blog-manager) - Description, author name/email (pre-filled from your git config)
- Minimum PHP version
- Extras to include (multi-select)
- Test runner (Pest or PHPUnit) when tests are enabled
What it generates
Always included:
composer.jsonwith PSR-4 autoloading and Laravel auto-discovery- A service provider (publishable config, feature wiring)
- A config file, main class, README, LICENSE, CHANGELOG
.gitignore,.gitattributes,.editorconfig
Optional (toggle during generation):
| Extra | Produces |
|---|---|
| Testing setup | Orchestra Testbench, a TestCase, example tests, phpunit.xml.dist (Pest or PHPUnit) |
| CI & quality tools | GitHub Actions (tests, PHPStan/Larastan, Pint), phpstan.neon, pint.json |
| Facade | src/Facades/<Name>.php + registered alias |
| Artisan command | src/Commands/<Name>Command.php, auto-registered |
| Migration | database/migrations/..._create_<table>_table.php, auto-loaded |
| Routes | routes/web.php, auto-loaded |
| Blade views | resources/views/example.blade.php, namespaced |
The service provider only wires up the features you select, so there are no
dangling references, and composer.json only pulls the dev dependencies you
actually need. A freshly generated package passes pest, phpstan and
pint out of the box.
Testing
The tool itself is covered by a Pest suite:
composer test
It exercises the string helpers, the derived PackageDefinition values, the
feature-aware composer.json builder, and the generator end to end — including
that every generated package is syntactically valid PHP.
How it works
bin/pcreators— console entry point (Symfony Console).src/Commands/NewCommand.php— the interactive wizard (Laravel Prompts).src/PackageDefinition.php— the user's answers plus every derived value (namespace, class names, slugs).src/ComposerManifest.php— builds the generatedcomposer.jsonfrom the selected features.src/PackageGenerator.php— maps stubs to destinations, resolves{{#feature}}…{{/feature}}blocks, and writes files.stubs/— the templates. Edit these to change what gets generated.
Stub syntax
{{ placeholder }}— replaced fromPackageDefinition::replacements().{{#feature}} … {{/feature}}— kept only when that feature is enabled.
Placeholders also work in destination paths, so src/ServiceProvider.php.stub
lands at src/<Name>ServiceProvider.php.
License
- This package is created and modified by Milwad Khosravi for Laravel/PHP has been released under the MIT License.
Contributing
This project exists thanks to all the people who contribute. CONTRIBUTING
Security
If you've found a security bug, please email milwad.dev@gmail.com instead of using the issue tracker.