laravel-providers

Service providers, bootstrapping, and application configuration. Use when working with service providers, app configuration, bootstrapping, or when user mentions service providers, AppServiceProvider, bootstrap, booters, configuration, helpers.

⭐3stars🔀0forks📁View on GitHub🕐Updated Dec 18, 2025

When & Why to Use This Skill

This Claude skill optimizes Laravel application architecture by streamlining service provider organization, bootstrapping patterns, and configuration management. It enables developers to implement clean, maintainable code structures for AppServiceProvider, environment handling, and global helpers, ensuring scalable and robust PHP applications following industry best practices.

Use Cases

  • Refactoring a cluttered AppServiceProvider into organized, named private methods to improve code readability and maintenance.
  • Implementing Eloquent Morph Map registrations and Data factory resolvers to enhance database flexibility and polymorphic relationships.
  • Setting up modular bootstrapping for middleware, scheduling, and exception handling using invokable booter classes to decouple core logic.
  • Managing environment-specific configuration templates and secure secret handling for local and production environments using .env-local patterns.
  • Standardizing the registration and autoloading of global helper functions while maintaining architectural integrity.
namelaravel-providers
descriptionService providers, bootstrapping, and application configuration. Use when working with service providers, app configuration, bootstrapping, or when user mentions service providers, AppServiceProvider, bootstrap, booters, configuration, helpers.

Laravel Providers

Service providers and application bootstrapping patterns.

Core Concepts

service-providers.md - Service providers:

  • AppServiceProvider organization with named methods
  • Model::unguard() for mass assignment
  • Factory resolver for Data classes
  • Morph map registration
  • Configuration patterns

bootstrap-booters.md - Bootstrap & Booters:

  • Invokable booter classes
  • Middleware registration
  • Exception handling setup
  • Scheduling configuration
  • Clean bootstrap organization

environment.md - Environment config:

  • Template and instance pattern
  • .env-local templates
  • Git-ignored instances
  • Optional git-crypt for secrets

helpers.md - Helper functions:

  • Global helper registration
  • Autoloading helpers
  • When to use (sparingly)
  • Alternatives with static methods

Pattern

// AppServiceProvider
final class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        $this->configureMorphMap();
        $this->configureDataFactories();
        Model::unguard();
    }

    private function configureMorphMap(): void
    {
        Relation::morphMap([
            'order' => Order::class,
            'product' => Product::class,
        ]);
    }
}

Organize AppServiceProvider with named private methods for clarity.