Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Manager Laravel Package

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.

View on GitHub
Deep Wiki
Context7

graham-campbell/manager adds a lightweight, reusable Manager abstraction for Laravel, ideal for building drivers/adapters with clean configuration and consistent resolution. It helps package and application authors centralize driver creation, selection, and caching in a familiar Laravel style.

Use it to implement your own “manager + drivers” APIs while keeping the core logic testable and framework-friendly.

  • Driver-based architecture with named drivers and a default selection
  • Lazy resolution and optional caching of created driver instances
  • Simple hooks to extend with custom drivers at runtime
  • Works cleanly with Laravel’s container and configuration conventions
  • Compatible across multiple Laravel and PHP versions
Frequently asked questions about Manager
How do I install graham-campbell/manager in a Laravel project?
Run `composer require graham-campbell/manager` to install the package. It supports Laravel 8–13 and PHP 7.4–8.5. No additional configuration is required unless you need custom drivers or facades, which can be set up via the `config/manager.php` file.
Can I use Laravel Manager for payment gateways like Stripe or PayPal?
Yes, Laravel Manager is perfect for payment gateways. Define drivers in your config, then resolve them via `Manager::connection('stripe')` or `Manager::connection('paypal')`. The package supports lazy resolution and caching for performance.
Does Laravel Manager support runtime driver extension (e.g., adding a custom driver without code changes)?
Absolutely. Use `Manager::extend('driver_name', CustomDriver::class)` to register drivers dynamically. This is ideal for plugins, SaaS multi-tenancy, or third-party integrations without modifying core code.
How do I mock or fake connections for testing?
Laravel Manager provides `Manager::fake()` for testing. You can also use `Manager::shouldReceive()` with Mockery to stub method calls. This works seamlessly with Laravel’s testing tools like `HttpTests` or `FeatureTests`.
Is Laravel Manager compatible with Laravel 5.x packages?
While the package officially supports Laravel 8–13, you can wrap older Laravel 5/6 packages in a Manager-compatible facade. Type hints may need adjustments, but the core abstraction remains compatible with modern Laravel conventions.
Can I use Laravel Manager for stateful connections like WebSocket streams?
Laravel Manager is optimized for stateless operations (e.g., API calls, database queries). For stateful connections like WebSockets, consider pairing it with Laravel’s event system or a dedicated connection manager to avoid leaks.
How do I handle configuration validation for drivers?
The package relies on Laravel’s config system, so invalid configs (e.g., missing API keys) may cause silent failures. Add validation in your driver’s `createConnection()` method or use Laravel’s `ValidatedConfig` trait to enforce rules.
Does Laravel Manager support async drivers (e.g., Guzzle HTTP clients with async-await)?
No, it lacks native async support. For async drivers, wrap them in a library like `spatie/async` or use `Manager::extend('http', fn() => new AsyncClient())` to integrate with Laravel’s async tools.
What are the performance implications of connection pooling?
Connection pooling improves performance for stateless operations by reusing instances. However, for high-throughput services, stale connections may cause issues. Use `Manager::reconnect()` or Laravel’s `app()->flush()` to manage connection lifecycles.
Are there alternatives to Laravel Manager for driver-based architectures?
Alternatives include Laravel’s built-in managers (e.g., `CacheManager`, `FilesystemManager`) or third-party packages like `spatie/laravel-activitylog` for auditing. However, Laravel Manager offers a lightweight, reusable abstraction tailored for custom driver systems without bloat.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport