nyoncode/laravel-package-toolkit
Toolkit for building Laravel packages with less boilerplate: configure routes, migrations, translations, views/components, middleware, assets and commands. Includes install/about commands, publishing options, lifecycle hooks, and package-specific exception handling.
Minor release — additive only, no breaking changes.
Event registration — register event listeners and subscribers directly from configure(), applied at boot via the Event facade:
hasEvents([Event::class => [ListenerA::class, ListenerB::class]]) — a map of event to listener(s); each value may be a class-string, a closure, or an array.hasEvent(Event::class, Listener::class) — a single event.hasSubscriber(Subscriber::class) / hasSubscribers([...]) — event subscriber classes.Optimize command registration — hasOptimizeCommands(optimize: 'pkg:cache', clear: 'pkg:clear') registers artisan commands that run with php artisan optimize and php artisan optimize:clear, forwarding to Laravel's ServiceProvider::optimizes(). The cache key defaults to the package short name.
Configurable publish tag separator — hasPublishTagSeparator() controls the format of publish tags:
{short-name}::{group} (e.g. my-package::config).'-' for the classic flat form (my-package-config).['::', '-']) to register every group under multiple tag forms at once, so consumers can publish with either; the first separator is primary and is used by the install command.The separator applies consistently to both vendor:publish tags and the package install command.
laravel/pint is now a runtime dependency.composer lint runs PHPStan with --memory-limit=512M.Full test suite: 252 passing, PHPStan level 5 clean.
hasAssets() stored a wrong path — the directory was validated as ../<dir> but stored without the ../
prefix, so vendor:publish --tag=<name>::assets silently published nothing.hasTranslations() rejected valid languages — the language-directory check used Collection::search(),
whose 0 index for the first supported language was treated as a failure. Region locales
(e.g. pt_BR, en-US) are now accepted as well.hasViews() broke with a custom path — a relative path was passed unresolved to loadViewsFrom() and an
absolute path (as documented) failed validation. Both are now resolved correctly.routes, view-components and view-component-namespaces publish tags did nothing — the corresponding
publish registrations were missing or never called. Route files are published to
routes/vendor/<package-short-name>/.publishMigrations() ignored an explicit file selection — publishing the whole directory of the first
migration file instead of the configured files.1; hasComponent() also registered the component twice.packageCommands() was never called — commands returned from the documented override are now registered.exit(0) — cancelling the production confirmation returns a proper exit
code instead of terminating the process.getVersion() no longer throws for packages without a composer name or not installed via Composer.PackageConfigWithFileNames was missing the Test suffix and never ran.bootVewComposers() was renamed to bootViewComposers(); the misspelled method is kept as a deprecated alias.phpstan.neon, level 5) so composer lint works.$tagSeparator — the tag separator is passed to the install
command instead of being hardcoded to ::.Packable is now part of the contract hierarchy — ProvidesPackageServices extends Packable, so
providers following the documented implements Packable pattern are covered by the toolkit itself.HasAbout contract — unused by the toolkit; Packable already declares aboutData(). Will be removed
in 3.0.illuminate/support constraint is now
^12.61.1|^13.12.0, pinning to the first releases patched against the June 2026 advisories. If you still depend on
Laravel 10 or 11, stay on the ~2.0.0 release.aboutData()
on a service provider was never included in the php artisan about output; only the
package Version was displayed. The provider's aboutData() is now passed through to
the packager and merged with the version data as documented.Fixed a bug when using the install command Added new tests
// Timeless files get auto-timestamped on publish: // create_posts_table.php → 2026_03_20_143022_create_posts_table.php
| Method | Description |
|---|---|
| hasDatePrefix(string $filename): bool | Check if a filename has a standard Laravel migration date prefix |
| shouldPrependTimestamp(): bool | Whether the current migration set contains timeless files |
| getMigrationPublishMapping(): array | Generate source → destination mapping with auto-timestamps |
Added support conditional loading Added support for Windows file system paths Added install command Added lifecycle hooks
Update docs
Small improvements
Full Changelog: https://github.com/NyonCode/laravel-package-toolkit/compare/1.1.1...1.2.1
Fix small bugs
Update concern Packable.php
Update README.md
Initial release
📦 Alfa Laravel Package Builder is here 🎉🎉
Full Changelog: https://github.com/NyonCode/laravel-package-builder/commits/v0.1.0-alfa
How can I help you explore Laravel packages today?