### Configure Package Service Provider with Package Toolkit Source: https://github.com/roundly-consulting/package-toolkit-for-laravel/blob/main/README.md Example service provider that uses the Package toolkit to configure a package named 'comments', including config file, migrations, translations, commands, and about contribution. The base provider wires console-gated publish, load, and command calls; migrations are published, never auto-loaded. ```php 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(), … } } ``` -------------------------------- ### Install Package Toolkit for Laravel via Composer Source: https://github.com/roundly-consulting/package-toolkit-for-laravel/blob/main/README.md Install the package using Composer. Requires PHP 8.4 and Laravel 12 or 13. ```bash composer require roundly-consulting/package-toolkit-for-laravel ``` -------------------------------- ### Build Key-Type Aware Migrations and Read Config Strictly Source: https://github.com/roundly-consulting/package-toolkit-for-laravel/blob/main/README.md Shows how to use the toolkit's schema macros and strict config reader. The migration uses morphKey with a key type from config, and auditable for timestamps and soft deletes. Config::integer reads strictly, throwing on invalid values like 'five'. ```php 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 ```