nyoncode/laravel-package-toolkit
Laravel Package Toolkit streamlines building Laravel packages with an expressive config API that auto-handles routes, migrations, views, translations, commands, and components, plus lifecycle hooks, middleware, events, and publishing options.
Architecture fit. This is a library for library authors, not an application dependency. Its unit of value is the Laravel package's ServiceProvider: instead of hand-writing mergeConfigFrom, loadRoutesFrom, loadMigrationsFrom, loadTranslationsFrom, loadViewsFrom, publish tags and optimizes(), a package author subclasses PackageServiceProvider, implements Packable, and declares intent in configure(Packager $packager). That is a thin decorator over well-known Laravel boilerplate, split deliberately into two collaborators — src/Concerns/ declares resources on Packager, src/Support/Concerns/ acts on them at register/boot. It fits cleanly wherever we own a portfolio of first-party Laravel packages (SDKs, internal platform modules, shared domain or UI packages). It does not belong in application code, and it is not a runtime framework concern.
Integration feasibility. Mechanically trivial: one composer require, one base class, one contract. No schema, no data migration, no service to operate. The real feasibility question is organizational — whether we want a single third-party base class in the inheritance path of every internal package.
Technical risk.
extends PackageServiceProvider is a one-way door. Backing it out means rewriting every adopting package's provider./llms.txt, and a shipped ai/AGENTS.md + MCP server + Claude skill installed via vendor/bin/package-toolkit-ai install. But hygiene is evidence of care, not evidence of production use.>= 12.61.1, >= 13.12.0) are unusually specific.Key questions.
PackageServiceProvider covered by semver such that ^2.x is safe to trust on minors?ai/ tooling read out of vendor/, and has that been reviewed?Stack fit. Qualifies only if the roadmap includes authoring Laravel packages. Hard prerequisites: PHP ^8.2 and Laravel 12.x (≥12.61.1) or 13.x (≥13.12.0). Confirm the fleet's Laravel baseline first — that alone may defer the decision.
Migration path. Greenfield only, initially. New internal packages extend PackageServiceProvider from day one. Do not retrofit existing packages: converting a working provider buys no user-visible value and creates a rollback problem across every consumer. Packages still on Laravel 10/11 can only use ~2.0.0, which sits on an EOL, unpatched Laravel line — treat that combination as unsupported rather than as a compatibility option.
Compatibility. Map the package inventory against the matrix before committing: Laravel 9 → ^1.0; 10/11 → ~2.0.0 (not recommended); 12.61.1+/13.12.0 → ^2.1. Any package we intend to support beyond one Laravel major needs an exit plan regardless of this decision.
Sequencing.
configure(), not scattered across register()/boot().Maintenance. Near-zero code maintenance inside our repos; the burden is dependency stewardship — reading changelogs, testing upgrades, watching Laravel-major coupling. Pin to a minor and bump deliberately. MIT licensing preserves a fork as the ultimate hedge, but forking a 0-star project means owning it outright.
Support. No vendor. Self-support plus upstream issues. Set that expectation with the team explicitly: this is a community dependency, not a supported platform component, and it should never sit under a customer-facing SLA without a fork contingency.
Scaling. Scales with package count, not traffic. Runtime cost is the provider boot plus whatever is declared; the when*() conditionals (whenLocal, whenProduction, whenConsole, whenClassExists, whenExtensionLoaded) exist precisely so dev-only resources don't load in production. The payoff compounds through consistency — many packages, one mental model, uniform publishing and install-command behavior.
Failure modes.
loadViewsFrom/publish calls.hasConfig([...]), hasRoute(directory: ...)) — wrong paths fail quietly rather than loudly.Broadcast::channel() files mistakenly routed through hasRoutes(), which loads them into the router rather than the broadcaster.Ramp-up. Low for anyone fluent in Laravel package conventions — the fluent API mirrors Laravel's own idioms, and lifecycle hooks are named after the register/boot phases developers already know. The docs site, per-resource pages with gotchas, changelog, and the shipped agent assets (ai/AGENTS.md, the Claude skill, the MCP server answering from installed source) meaningfully shorten onboarding and answer questions in-editor. The counterweight is that it is one more abstraction and a second set of conventions alongside vanilla Laravel, so budget a short internal walkthrough and a review rule against hand-rolling what the packager already does.
How can I help you explore Laravel packages today?