Looking to hire Laravel developers? Try LaraJobs

package-toolkit-for-laravel maintained by roundly-consulting

Description
A native, dependency-free toolkit for building Laravel packages: a fluent package-bootstrap builder, schema key-type macros, and database/config/model helpers.
Last update
2026/10/03 19:47 (dev-main)
License
Downloads
262

Comments
comments powered by Disqus

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.