packstub / partisan
Artisan for Laravel packages — run make: generators from your package directory and get files in src/ with your package namespace. Built on Orchestra Testbench.
Requires
- php: ^8.2
- orchestra/canvas: ^10.0 || ^11.0
- orchestra/sidekick: ^1.2
- orchestra/testbench: ^10.0 || ^11.0
Requires (Dev)
- filament/filament: ^4.0
- pestphp/pest: ^3.7 || ^4.0
- symfony/process: ^7.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Artisan for Laravel packages. Run every make: generator from your package directory and get files in src/ with your package's namespace — models, commands, migrations, factories, tests, and full Filament resources included.
Built on Orchestra Testbench and Canvas, the tools that already power Laravel package testing. Partisan adds the missing piece: generators that understand your package is the app.
composer require --dev packstub/partisan
vendor/bin/partisan make:model Invoice
# → src/Models/Invoice.php with `namespace Acme\Widget\Models;`
What you get
Partisan reads your package's composer.json and points the whole generator suite at it:
| Command | Destination | Namespace |
|---|---|---|
make:model Invoice |
src/Models/Invoice.php |
Acme\Widget\Models |
make:command SyncInvoices |
src/Console/SyncInvoices.php |
Acme\Widget\Console |
make:migration create_invoices_table |
database/migrations/… |
— |
make:factory InvoiceFactory |
database/factories/… |
Acme\Widget\Database\Factories |
make:seeder InvoiceSeeder |
database/seeders/… |
Acme\Widget\Database\Seeders |
make:test InvoiceTest |
tests/Feature/… |
Acme\Widget\Tests\Feature |
make:filament-resource Invoice |
src/Filament/Resources/… |
Acme\Widget\Filament\Resources\… |
…and the rest of the make: family (casts, controllers, events, jobs, listeners, mail, middleware, notifications, policies, providers, requests, rules, views, components, enums, interfaces, traits, and more). Generated feature tests extend your package's own tests/TestCase.php when you have one, or Orchestra\Testbench\TestCase otherwise.
Because partisan wraps the Testbench CLI, everything Testbench can do still works — vendor/bin/partisan serve, migrate, route:list, your package's own commands, workbench:install, all of it.
How it works
Testbench boots a skeleton Laravel application around your package; Canvas routes every generator through a pluggable generator preset. Partisan registers a preset that maps the generator targets onto your package:
autoload.psr-4→ source path and root namespaceautoload-dev.psr-4→ tests path and namespacedatabase/,resources/→ database and view targetsextra.laravel.providers→ auto-registered, so your package's own artisan commands are available too
The workbench and laravel presets stay available per command (make:model Demo --preset=workbench) when you want to generate into your Workbench demo app instead.
Run vendor/bin/partisan partisan:about to see exactly how your package was mapped.
Filament plugins
If your package targets a Filament panel, declare a panel provider (in extra.laravel.providers) whose discovery paths use app_path() — partisan remaps app_path() to src/, so Filament's generators follow along:
$panel->discoverResources(in: app_path('Filament/Resources'), for: 'Acme\\Widget\\Filament\\Resources')
Then make:filament-resource Invoice produces the resource, pages, schema, and table classes inside src/Filament/Resources under your namespace.
Configuration
Partisan needs none for the common case. It honors your testbench.yaml (providers, custom skeleton, migrations, seeders) exactly like the Testbench CLI. Set PARTISAN_DISCOVER=0 to skip auto-registering the providers from extra.laravel.providers.
Notes
make:command SyncInvoicesoffers to register the new command in your package's service provider (automatic under--no-interaction, opt out with--no-register). It inserts into an existing$this->commands([...])or spatie-style->hasCommands([...])block — adding the import, never duplicating an entry — and appends a fresh$this->commands([...])block toboot()when the provider has neither.make:model Invoice --factorywires the model to its package factory automatically: theHasFactorydocblock points at yourDatabase\Factoriesnamespace and a#[UseFactory(InvoiceFactory::class)]attribute is added, soInvoice::factory()resolves at runtime with no manualnewFactory(). If a future Laravel stub ships its own factory wiring, partisan detects it and only corrects the namespace.make:providerwrites the class intosrc/Providers; registering it in your package's service provider chain is up to you.
Testing
composer test
The suite generates every supported file type into a disposable fixture package and asserts the paths and namespaces, for both Laravel and Filament generators.
License
MIT