---
title: "Package Toolkit for Laravel — docs | Roundly"
description: "Developer docs for Package Toolkit for Laravel: a fluent provider builder, publish-only migrations, key-type schema macros and config validation."
url: https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

Open source

# Package Toolkit for Laravel

Install

`composer require roundly-consulting/package-toolkit-for-laravel`

Requires: PHP ^8.4 · Laravel ^12.0|^13.0

[GitHub](https://github.com/roundly-consulting/package-toolkit-for-laravel) [Packagist](https://packagist.org/packages/roundly-consulting/package-toolkit-for-laravel) [Donate (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Patreon](https://www.patreon.com/cw/roundly)

## Overview

A native, dependency-free toolkit for building Laravel packages. Extend one base service provider, describe what your package ships in a fluent builder, and every console-gated publish, load and command call is emitted for you — once. Alongside it come key-type aware schema macros, a portable, injection-safe LIKE search, validate-or-throw config accessors (secret readers among them), a model resolver and a facade trait that keeps secret arguments out of stack traces. MIT-licensed and built only on official Laravel and Symfony APIs.

### What you get

#### Fluent package builder

Extend one base provider and declare config, migrations, views, translations, routes, commands, aliases and about output in a single chain.

#### Publish-only migrations

Migrations publish with ordered timestamps and republish in place — never auto-loaded, never duplicated, never written over your own.

#### Key-type schema macros

One config-driven bigint/uuid/ulid strategy with ownerKey(), morphKey(), polymorphicSubject() and auditable().

#### Strict config readers

Integer, decimal, string, list, enum, fixed-vocabulary and boolean readers, plus secret readers that never echo the value: a value that is not set — absent, null or blank, like a host’s KEY= — takes the default, anything else invalid throws. DTO arrays and your own exception class too.

#### Portable, safe search

whereLikeEscaped() escapes user wildcards and uses ILIKE on Postgres, LIKE elsewhere — on query and Eloquent builders.

#### Idempotent by design

Gates, Blade directives and macros register once, even on a double boot — plus a PHPStan extension for the macros.

### Documentation

#### [Installation](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/installation.md)

Install via Composer — the toolkit is a library your package’s service provider builds on, with nothing to publish.

#### [The package builder](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/package-builder.md)

Extend PackageServiceProvider, describe your package in configurePackage(), and let the base provider wire the rest.

#### [Builder methods](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/builder-methods.md)

Every Package builder method — config, migrations, translations, views, routes, commands, aliases, about and stubs — with its publish tag.

#### [Publish-only migrations](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/migrations.md)

Package migrations are never auto-loaded: they publish with ordered timestamps, republish in place, and the host runs migrate.

#### [Bindings & observers](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/bindings-observers.md)

Bind a contract to the class named in config and attach an observer to a configurable model — from register() and boot().

#### [Opt-in traits](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/opt-in-traits.md)

Idempotent gate, Blade directive and schema-macro registration — a double boot never clobbers or double-registers anything.

#### [Key types & schema macros](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/key-types.md)

One config-driven bigint/uuid/ulid key strategy with the ownerKey(), morphKey(), polymorphicSubject() and auditable() macros.

#### [Static analysis (PHPStan)](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/static-analysis.md)

A bundled PHPStan extension declares the schema and query macros, so Larastan never reports them as undefined methods.

#### [Database helpers](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/database-helpers.md)

A DatabaseDriver enum for driver-aware branching and whereLikeEscaped() — a portable, injection-safe “contains” search.

#### [Config validation](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/config-validation.md)

Strict config readers — integers, decimals, strings, lists, enums, fixed vocabularies and booleans, DTO arrays and your own exception class.

#### [Secrets in config and facades](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/secrets.md)

Read API keys and key rings with errors that never show the value, and keep secret facade arguments out of stack traces with one trait.

#### [Model resolution](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/model-resolution.md)

Resolve a configurable Eloquent model class with ModelResolver or ResolvesModels — a class not extending the packaged model throws.

#### [Exceptions & retry-after](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/exceptions.md)

The toolkit’s exception hierarchy with its exact messages, plus the HasRetryAfter contract for rate-limit errors.

#### [Migrating a package](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/migrating.md)

Move an existing hand-wired package onto the toolkit in four steps — provider, key types, helpers, quality gate.

#### [Testing](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/testing.md)

Load your package’s migrations explicitly in its TestCase, then test config guards, macros and directives through the public API.

#### [Requirements](https://roundly-consulting.com/open-source/docs/package-toolkit-for-laravel/requirements.md)

PHP 8.4+ and Laravel 12 or 13 — no other runtime dependencies. Add phpstan/extension-installer to load the PHPStan extension automatically.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source.md)
