wendelladriel/laravel-expressive
Laravel Expressive adds clean, fluent helper methods to Laravel, letting you write more readable and expressive code. It cuts boilerplate and keeps common operations concise and chainable, so your application stays elegant and easier to maintain.
Install the package and confirm the command surface before writing any code:
composer require wendelladriel/laravel-expressive --dev
php artisan vendor:publish --tag="expressive-config" # check `php artisan vendor:publish` for the exact tag
php artisan list | grep -i expressive
Two things to inspect first:
First use case: generate a single class for a feature you're already building.
php artisan make:expressive Foo
Then immediately run the drift check against what you just generated. It should report clean — if it doesn't, your stub or config is misaligned and you want to know that on day one, not after fifty files exist:
php artisan expressive:sync --all # command name may differ; verify with `php artisan list`
Once a single generate-then-check cycle is green, you're ready to use the v1.2.0 bulk features.
Single-class generation during feature work. Generate as you go, one class at a time, and review the diff before committing. This keeps stub changes visible and stops a stale template from silently propagating across the codebase.
Bulk generation for scaffolding a new domain. v1.2.0 adds bulk Expressive generation — the payoff is bootstrapping a whole slice (model-adjacent classes, actions, concerns) in one pass rather than N invocations. Typical workflow:
# scaffold a batch, then review with git before staging anything
php artisan make:expressive --all # verify flags via `php artisan help make:expressive`
git status
git diff
Treat bulk output as a starting draft: run it, then edit. The git diff review step is non-negotiable — bulk generation multiplies both correct output and mistakes.
Drift checks in CI. sync-all drift checking is the most valuable new capability, because it turns "our generated classes match our current stubs" into an enforceable invariant. Wire it into CI as a non-mutating gate:
- run: php artisan expressive:sync --all --dry-run # confirm the dry-run flag exists first
The pattern that matters: CI checks for drift, developers resolve it locally. If CI auto-fixes, drift becomes invisible and stub edits land without review. Run the check in CI, fail the build, and require a human to regenerate and commit.
Stub-first customization. If your team has house conventions (final classes, strict types, custom docblocks), edit the stubs once and regenerate rather than hand-editing output. Hand edits become drift, and drift becomes CI failures you then have to triage individually.
Pair generation with a lint/static-analysis pass. Bulk generation touches many files at once; run Pint and PHPStan/Psalm immediately afterwards so formatting and type issues are fixed in one sweep instead of trickling into unrelated PRs.
php artisan help <command> rather than trusting assumptions from a previous version.git status before anything else.sync-all compares generated output against stubs. It will not tell you whether a class is still used, referenced, or semantically correct. Refactors that delete or rename classes need their own cleanup pass.composer.json autoload rules fails in ways that read like unrelated errors. Run composer dump-autoload after generating into new directories.require-dev. It's a development-time generator; shipping it to production adds weight with no runtime benefit. Make sure CI installs dev dependencies for the drift check to run.actions/checkout 6→7) is CI hygiene, not a functional change — no action needed beyond confirming your workflows still pass.How can I help you explore Laravel packages today?