roundly-consulting / package-toolkit-for-laravel
A native, dependency-free toolkit for building Laravel packages: a fluent package-bootstrap builder, schema key-type macros, and database/config/model helpers.
Package info
github.com/roundly-consulting/package-toolkit-for-laravel
pkg:composer/roundly-consulting/package-toolkit-for-laravel
Fund package maintenance!
Requires
- php: ^8.4
- illuminate/contracts: ^12.0|^13.0
- illuminate/database: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.5
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/phpstan-deprecation-rules: ^2.0
- roundly-consulting/testing-for-laravel: ^1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Package Toolkit for Laravel
A native, dependency-free toolkit for building Laravel packages: a fluent package-bootstrap builder, key-type aware schema macros, strict config readers and small database and model helpers — built only on official Laravel and Symfony APIs.
Installation
Requires PHP 8.4 and Laravel 12 or 13.
composer require roundly-consulting/package-toolkit-for-laravel
Usage
Describe what your package ships — the base provider wires every console-gated publish, load and command call (migrations are published, never auto-loaded):
use RoundlyConsulting\PackageToolkit\Concerns\RegistersBlueprintMacros; use RoundlyConsulting\PackageToolkit\Package; use RoundlyConsulting\PackageToolkit\PackageServiceProvider; final class CommentsServiceProvider extends PackageServiceProvider { use RegistersBlueprintMacros; public function configurePackage(Package $package): void { $package ->name('comments') // tags: comments-config, comments-migrations, … ->hasConfigFile() ->hasMigrations() ->hasTranslations() ->hasCommands([PruneCommentsCommand::class]) ->contributesToAbout(); } public function boot(): void { parent::boot(); $this->registerBlueprintMacros(); // morphKey(), ownerKey(), auditable(), … } }
Then build key-type aware migrations and read config strictly:
use RoundlyConsulting\PackageToolkit\Enums\KeyType; use RoundlyConsulting\PackageToolkit\Support\Config; Schema::create('comments', function (Blueprint $table): void { $table->id(); $table->morphKey('commentable', KeyType::fromConfig('comments.key_type')); // bigint, uuid or ulid pair $table->text('body'); $table->auditable(); // timestamps + soft deletes }); Config::integer('comments.per_page', 20, min: 1, max: 100); // '20' → 20; 'five' throws, never falls back
Documentation
The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/package-toolkit-for-laravel
Release notes are in CHANGELOG.md. To contribute, see the contributing guide.
Support our work
This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.
License
The MIT License (MIT). See LICENSE.md.