Laravel Package Tools

A fluent PackageServiceProvider that removes the boilerplate from building Laravel packages.

Library
Composer
v1.93.1
953stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
62/100Good
Development Activity24
Maintenance52
Community72
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
86/100Excellent
Architecture88
Code Quality90
Innovation80
Learning Curve85

Laravel Package Tools, maintained by Spatie, provides a base PackageServiceProvider and a fluent Package configuration object that let package authors register config files, migrations, views, Blade and Inertia components, routes, translations, assets, and console commands with a single chained call. Instead of hand-writing repetitive boot and register logic in every package, you describe your package declaratively and the provider wires up publishing tags, loading, and lifecycle hooks for you.

It is the foundation used by nearly all of Spatie’s own Laravel packages and by thousands of community packages, and it pairs with the spatie/package-skeleton-laravel starter to give a consistent, opinionated project structure that just works with the provider out of the box.

What You Get

  • An abstract PackageServiceProvider with a single configurePackage() entry point
  • A fluent Package builder for config, migrations, views, routes, translations, assets, and commands
  • Automatic registration of publishing tags so users can run vendor:publish without extra wiring
  • A composable InstallCommand for guided package setup (publish assets, run migrations, star repo)
  • Lifecycle hooks (registering/registered/booting/booted) for custom package logic

Common Use Cases

  • Bootstrapping the service provider for a new open-source Laravel package
  • Registering publishable config, migrations, and views without repetitive boilerplate
  • Shipping an interactive install command that sets up your package in the host app
  • Standardizing provider structure across a suite of related packages

Under The Hood

Architecture - The package is built around one abstract class, PackageServiceProvider, which composes a dozen Process* traits (ProcessConfigs, ProcessMigrations, ProcessViews, ProcessCommands, etc.) via src/Concerns/PackageServiceProvider. A parallel set of Has* traits on the Package value object (src/Concerns/Package) captures the fluent declarations, and the provider’s register()/boot() methods walk that configuration to load resources and register publish groups.

Tech Stack - Pure PHP 8.1+, depending only on illuminate/contracts (Laravel 10-13) so it stays framework-light. Dev tooling uses Pest 2-4 with Orchestra Testbench for provider testing, Mockery, and PHPUnit code coverage.

Code Quality - The codebase is small, trait-composed, and heavily tested: roughly 90+ test files under tests/ exercise each resource type against a real service provider using Testbench. Naming is consistent (hasX/processX), invariants like the required package name are enforced with a dedicated InvalidPackage exception.

API Design - The public surface is a single configurePackage(Package $package) method with a discoverable fluent builder; method names read like the feature they enable (hasConfigFile, hasMigration, hasInstallCommand). Getting started requires almost no boilerplate, and the companion package-skeleton repo makes the expected directory layout obvious.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search