Search by

roundly-consulting / package-toolkit-for-laravel

mihaliak

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!

Patreon

Statistics

Installs: 262

Dependents: 49

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 17:47 UTC

This package is auto-updated.

Last update: 2026-10-03 17:51:50 UTC


README

Package Toolkit for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

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.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). See LICENSE.md.