juststeveking/laravel-stubs
Laravel Stubs provides publishable stub files for Laravel's make commands, letting you customize generated classes, controllers, models, and other scaffolding to match your project's conventions without editing vendor files.
Architecture fit. This package sits entirely in the developer-enablement layer, not the application architecture. It ships stub templates that Artisan's make:* commands render — models, controllers, migrations, jobs, events, policies, form requests. There is no service provider in the runtime path doing anything customer-visible, no container binding, no route registration, no schema effect, no deploy artifact. For a TPM that means it belongs in the same governance bucket as Pint, Larastan, and Rector: configuration-as-code that shapes how the team writes software, not what the software does. Fit is high conditional on a written convention existing. If the team has an agreed standard (declare(strict_types=1), final-by-default, typed properties, promoted constructors, defined namespaces), the stubs are a head start that makes generated code pass CI on the first run. If the standard is unstated or contested, this package becomes a proxy for a debate that then plays out in code review, which is the worst possible venue.
Integration feasibility. Mechanically trivial: a dev-only Composer require, one Artisan publish command, and the stub files land in the project. The genuine cost is organizational — one standards-owner review, one alignment conversation, one documentation update. Size this in hours of engineering plus a meeting. Anyone proposing a sprint for it is over-scoping; anyone proposing zero time is under-scoping the decision step.
Technical risk. Low on runtime, moderate on process, with one dependency risk to record explicitly:
final classes and strict types can break mocking strategies and legacy untyped code paths. This often surfaces as test failures weeks after adoption, so a canary service and a one-commit rollback plan are prerequisites, not niceties.Key questions to close before a go decision.
Stack fit. Orthogonal to everything else in the stack. It is indifferent to database, queue driver, frontend, hosting model, and team topology, and it composes cleanly with a "generated code is already compliant" workflow. The one real collision risk is a second stub-publishing package in the same repository — resolution order and publish conflicts produce "why did my model generate wrong" incidents that are slow and expensive to diagnose, and they erode trust in the scaffolder itself.
Migration path — harvest, do not depend. Frame this as a decision gate, not an engineering preference:
stubs/ directory as first-class source, commit it, and remove the package from composer.json. If they do not: lift the good parts into an internal stub set and move on. Either way the dependency does not persist.CONTRIBUTING.md and add a CI assertion that a freshly generated artifact passes lint and static analysis. Without this step, adoption decays as soon as attention moves elsewhere.The stakeholder framing: this converts a zero-star dependency into roughly fifteen reviewed template files we own outright. The value is in the opinion, not the package.
Compatibility. Two hard constraints — Laravel major and PHP minor — and the Laravel one fails silently. Stub filenames must match what that release's make commands expect. Add a line to the standard Laravel upgrade checklist: re-verify vendored stubs against the new skeleton, generate one artifact per stub type, diff. It is a ten-minute recurring task that prevents a year of quiet divergence. Pin the PHP version alongside it; promoted-constructor and readonly syntax in stubs need a minimum PHP minor that should be stated in the README.
Sequencing and schedule risk. Standards owner reviews contents (half a day) → branch spike and diff (half a day) → team review of proposed conventions (the long pole: budget a decision owner and a date, not a sprint) → vendor, drop the dependency, document (one day) → optional CI assertion. Engineering effort is small; essentially all schedule risk is concentrated in the review step. The TPM's job is to ensure that step has a named decision-maker, otherwise the spike rots on a branch and the effort is wasted.
Rollout scope. Greenfield services, new bounded contexts, and the shared starter template only. Do not retrofit into existing repositories mid-sprint — the diff is noise there, conventions are already de facto settled, and the retrofit risk outweighs the benefit.
Maintenance. Near zero once vendored: inert text files that change only when we deliberately change them. If kept as a live dependency instead, maintenance becomes a per-major audit plus dependency-bot noise, for a package that provides no runtime capability. Vendoring is strictly better on this axis, so "keep the dependency" should be the option requiring justification.
Support and ownership. No commercial support, no SLA, single maintainer, no observable consumer base. Internal ownership must be assigned by name — realistically the same person or guild that owns Pint/Larastan configuration and the written code standard. The failure mode of unowned stubs is not breakage; it is slow divergence, where half the codebase is generated one way and half another and nobody notices for a year.
Scaling. Scales linearly and cheaply: vendored files replicate with the repository, cost nothing at build or runtime, and impose no per-service overhead. The characteristic that does not scale is judgment — a single stub set across many teams requires the standard to be genuinely shared, or each team will fork its own stubs and the consistency benefit evaporates.
Failure modes to monitor. (a) Misnamed or removed stub → silent fallback to framework defaults; detect with a CI job that generates one artifact per stub type and diffs it against a committed expectation. (b) Framework major upgrade changes stub shape → generated code diverges from the new skeleton; detect at upgrade checklist time, not in production. (c) Second stub-publisher in the repo → resolution-order bugs; detect by convention, one scaffolder per repository. (d) Stubs encoding opinions incompatible with test tooling → surface as late test failures; detect with a canary service before fleet rollout. None of these are customer-visible, which is precisely why they need automated detection — nobody will notice them manually.
Ramp-up. Very low for engineers who already know Artisan: the mental model is "the templates are ours now," and reading fifteen files takes under an hour. The ramp-up cost sits with new hires who will follow tutorials that assume stock Laravel output — so the README and CONTRIBUTING.md must state explicitly why our generated code differs from the defaults, or newcomers will "fix" it back to the framework shape. Budget a paragraph of documentation, not a training session.
How can I help you explore Laravel packages today?