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.
composer.json copy-pastes.ai/AGENTS.md, a Claude Code skill, and a zero-dependency MCP server installed into consuming projects via vendor/bin/package-toolkit-ai install. That maps to a separate roadmap item (agent readiness of internal codebases) and is arguably its most differentiated feature.whenProduction(), whenLocal(), whenClassExists(), whenExtensionLoaded() give a supported pattern for loading commands and config only where appropriate — useful for a "no dev-only tooling in production" compliance decision.Consider it when:
Look elsewhere when:
~2.0.0/^1.0 only as a stopgap; you are adopting an unsupported branch of an already-low-adoption library.spatie/laravel-package-tools already covers your needs. It is the incumbent default with broad adoption; the burden of proof is on the challenger. Compare feature-by-feature before switching — the toolkit's differentiators appear to be lifecycle hooks, conditional registration, optimize-command wiring, broadcast channels, and the AI surface.PackageServiceProvider is a hard structural commitment. Teams preferring composition, or packages with unusual boot ordering, should not adopt.Decision to make explicitly: adopt, vendor-and-fork, spike-only, or reject. Given the adoption signals, "vendor-and-fork with a pinned version" is the defensible middle; blanket "adopt as a dependency across all repos" is not.
For executives — one paragraph: This is an internal developer-efficiency library, not a customer-facing feature. It standardizes how we build reusable Laravel packages so engineers stop rewriting the same wiring for config, routes, migrations, views, translations, middleware, and commands. MIT-licensed, no purchase cost; the only cost is engineering attention. The strategic upside is speed and consistency when we extract shared capabilities into packages across products — plus an unusual bonus: it ships tooling that makes our codebases legible to AI coding agents, which supports our developer-productivity goals. The strategic risk is maturity: effectively zero public adoption and a single-maintainer profile, so we should treat it as code we may have to own, not a vendor we can lean on. Recommendation: a time-boxed spike against our existing packages, with a go/no-go gated on whether we can vendor it and whether it beats the incumbent spatie/laravel-package-tools for our actual use cases.
For engineering — the summary: Extend PackageServiceProvider, implement Packable, and declare your package in configure(Packager $packager) with a fluent, self-validating API (->name(), ->hasConfig(), ->hasRoutes(), ->hasMigrations(), …). It handles the register/boot work, adds lifecycle hooks (registeringPackage() / registeredPackage() / bootingPackage() / bootedPackage()), conditional resource loading (whenLocal(), whenProduction(), whenConsole(), whenClassExists()), middleware aliases/groups/globals, events and subscribers, broadcast channel files, optimize/optimize:clear commands, publishable seeders/factories/stubs, and an install command. Architecture is two-sided by design — src/Concerns/ declares on Packager, src/Support/Concerns/ acts on the provider — so plan for that split when extending it. Quality signals are respectable for a library this young: full Pest suite on Orchestra Testbench, PHPStan/Larastan level 7 on src, Pint-enforced formatting, a real docs site with per-resource pages and gotchas. Constraints to accept up front: PHP ^8.2, Laravel 12.61+/13.12+ only, inheritance-based coupling, and the fact that channel files are deliberately non-publishable (consumers override by re-registering). Cost of validation: a one-to-two-day spike, one package ported, compare diff size and boot-order surprises against the incumbent.
For the sponsor's decision log: Approve evaluation, not adoption. Success criteria: measurable reduction in per-package setup effort, no boot-order regressions, and a documented exit path (vendored fork under our maintenance if upstream stalls).
How can I help you explore Laravel packages today?