Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Package Toolkit

Laravel Package Toolkit Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Laravel Package Toolkit is a streamlined framework for building and maintaining Laravel packages. It replaces repetitive boilerplate with expressive abstractions, so you can register routes, migrations, views, translations, commands, and components through a single, readable configuration.

Its lifecycle hooks, conditional resource loading, and install command with customizable publishing options give you fine-grained control over how your package boots and ships. Built-in exception handling, middleware, events, and optimize-command support round out a production-ready toolkit.

  • Expressive configuration for routes, migrations, views, translations, and commands
  • Lifecycle hooks and environment-based conditional loading
  • Install command with customizable publishing options
  • Middleware, events, and broadcast channel registration
  • Publishable seeders, factories, and generator stubs
Frequently asked questions about Laravel Package Toolkit
How do I install nyoncode/laravel-package-toolkit?
Install it with Composer using composer require nyoncode/laravel-package-toolkit, then let Laravel package discovery register the service provider automatically. From there you configure your own package's service provider with the Packager DSL and the toolkit handles routes, migrations, views, translations, commands, events, middleware, and more. The install command also exposes publishing options for config, seeders, factories, and generator stubs.
Which Laravel versions does Laravel Package Toolkit support?
Current releases support Laravel 12.x from 12.61.1 onward and Laravel 13.x from 13.12.0 onward. Laravel 10.x and 11.x support was removed in v2.1 because those branches passed security end-of-life and the June 2026 advisories were only patched in Laravel 12.60+/13.9+. If you must stay on Laravel 10 or 11 use the ~2.0.0 release line, and for Laravel 9 use ^1.0.
How do I configure routes, migrations, views, and translations with the Packager DSL?
You define your package resources declaratively in the package's service provider instead of writing manual boilerplate for each one. The Packager DSL covers routes, migrations, translations, views, commands, events, broadcast channels, seeders, factories, and middleware, and the toolkit registers them following Laravel conventions. The documentation site at package-toolkit.nyoncode.cz has a dedicated page per resource type with examples and gotchas.
What are the lifecycle hooks in Laravel Package Toolkit and when should I use them?
The toolkit exposes granular lifecycle hooks such as registeringPackage and bootingPackage so you can hook into specific phases of a package's initialization. Use the registration-phase hooks for container bindings and config merging, and boot-phase hooks for anything that depends on other packages already being registered. This keeps registration, booting, and runtime logic cleanly separated instead of stuffing everything into one service provider method.
How does conditional resource loading work and does it affect performance?
You can scope resources to environments with helpers such as whenLocal() and whenProduction(), so development-only routes, views, or commands never get registered in production. The checks run once during package registration, so the runtime overhead is negligible compared with the boot cost you avoid by not loading unused resources. It also pairs well with route and config caching because the conditional branches resolve deterministically per environment.
Does Laravel Package Toolkit support Blade view components and shared view data?
Yes, the toolkit supports view components, component namespaces, view composers, and shared data registration. Be careful to namespace component names and shared data keys to your package, because globally registered composers or shared variables can leak into other packages or the host application. Reviewing component namespaces is the main thing to verify when building a package that will be installed alongside others.
Can I register Artisan commands, events, listeners, and middleware with it?
The toolkit provides registration helpers for Artisan commands, events, event subscribers, broadcast channels, and middleware, plus optimize and optimize:clear command support. This removes the usual manual arrays in your service provider and keeps registration declarative. Watch out for global middleware registration, since ordering against an existing middleware stack matters and aliases can clash with middleware defined elsewhere in the application.
Is Laravel Package Toolkit production ready?
The core features are low risk because they abstract repetitive Laravel conventions rather than replacing framework behavior, and recent releases add Larastan level 7 static analysis in CI to reduce type-related defects. The main caveat is ecosystem maturity: the package has a limited number of stars and dependents, so real-world validation is thinner than with more established alternatives. Test your package-specific logic, especially conditional routes and middleware ordering, before shipping.
Is it safe to upgrade from 2.1.1 to 2.5.3?
Semver minor releases should be additive, and the 2.5.3 change itself is a static-analysis hardening patch that does not alter the DSL surface, lifecycle hook contracts, or resource-resolution semantics. However, 2.5.3 is four minor versions ahead of 2.1.1, so review the changelogs for 2.2 through 2.5 as part of the upgrade ticket rather than assuming a single small delta. Existing package configuration should carry over, but run your test suite against the new version.
How does Laravel Package Toolkit compare to Spatie Laravel Package Tools?
Both packages aim to remove boilerplate from Laravel package development, and both rely on a fluent configuration object in your service provider. Spatie's package is far more widely adopted and has a larger body of real-world usage, while this toolkit adds lifecycle hooks, environment-aware conditional loading, view components, broadcast channels, seeders, factories, and optimize command support in one place. Choose Spatie if ecosystem maturity is your priority, and this toolkit if you want the broader built-in feature set and are comfortable reviewing its code.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style