graham-campbell/manager
Laravel Manager provides reusable manager functionality for Laravel apps. It helps you build driver-based services with a consistent API for creating, caching, and resolving implementations. Supports PHP 7.4–8.5 and Laravel 8–13.
Standardized Multi-Service Architecture: Accelerates adoption of a unified connection management pattern across Laravel packages, reducing technical debt from fragmented implementations (e.g., DatabaseManager, CacheManager). Enables teams to consolidate driver logic (e.g., payment gateways, APIs, storage) under a single interface, improving maintainability and reducing onboarding friction for developers.
AbstractManager to inherit connection pooling, config resolution, and dynamic extension.AuthService into OAuth2/SAML/LDAP drivers) or migrating legacy Laravel 5/6 packages to Laravel 10+ while preserving custom logic.Dynamic Driver Extensibility Without Code Changes: Supports configuration-driven extensibility, enabling:
Manager::extend() without deploying code changes.Manager::extend('logging', fn() => new DatadogLogger())) for compliance or legacy system integration.StorageManager with runtime switching via config.Build vs. Buy Decision:
TaskManager, WorkflowManager) when off-the-shelf solutions lack domain-specific features.Performance Optimization:
connection()->method() caching.Laravel Ecosystem Alignment:
Illuminate\Support\Manager), reducing cognitive load for developers familiar with the framework.graham-campbell/flysystem or graham-campbell/digitalocean can leverage Manager for unified config and driver handling.Adopt When:
Manager::extend()).Look Elsewhere When:
Illuminate\Contracts\Queue\* or custom event-driven managers.*"This package lets us standardize how Laravel services manage dynamic connections—like databases, APIs, or payment gateways—without reinventing the wheel. For example:
*"Problem: Every Laravel package with dynamic drivers (e.g., DatabaseManager, CacheManager) reinvents connection pooling, config resolution, and extension logic.
Solution: graham-campbell/manager gives you:
PaymentManager, AnalyticsManager) with built-in connection reuse and dynamic extension.AbstractManager and implement createConnection(). No service providers or complex setup.Manager::extend('stripe', fn() => new StripeClient()) without redeploying.*"Need a clean, tested way to manage multiple drivers (e.g., S3 + GCS + Azure) in Laravel? This package gives you:
manager->connection('s3')->put()).Manager::extend() at runtime (e.g., manager->extend('custom', fn() => new MyDriver())).manager->method() directly on the default connection (e.g., manager->listBuckets() instead of manager->connection()->listBuckets()).AbstractManager and go.
Example: Replace your custom StorageManager with this in <10 lines of code and get Laravel-native connection handling for free."*How can I help you explore Laravel packages today?