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 a lightweight base for building driver-based “manager” services in Laravel apps. Supports PHP 7.4–8.5 and Laravel 8–13, offering consistent configuration, driver creation, and resolution patterns for your own integrations.

View on GitHub
Deep Wiki
Context7

Providing some manager functionality for Laravel

Frequently asked questions about Manager
How do I use Laravel Manager to create a custom payment gateway integration?
Start by defining a `PaymentGatewayManager` class extending `Manager`. Register your drivers (e.g., Stripe, PayPal) in the `extend()` method, then inject the manager into your service. Each driver must implement `ManagerInterface` with `connect()` and `disconnect()` methods. Configuration is handled via Laravel’s config system, so no extra setup is needed.
Does Laravel Manager work with Laravel 13 and PHP 8.5?
Yes, Laravel Manager officially supports Laravel 8–13 and PHP 7.4–8.5. The package is regularly updated to ensure compatibility with new Laravel releases. Check the [GitHub releases](https://github.com/GrahamCampbell/Laravel-Manager/releases) for version-specific notes.
Can I dynamically switch between drivers at runtime (e.g., failover for APIs)?
Yes, use the `extend()` method to register drivers dynamically or switch connections via `Manager::setDriver()`. For failover logic, implement reconnection logic in your driver’s `connect()` method or use Laravel’s container to bind a fallback driver conditionally.
How does lazy loading improve performance in high-traffic Laravel apps?
Connections are instantiated only when first used, reducing memory overhead for unused drivers. This is ideal for multi-tenant apps (e.g., a CRM with Salesforce/HubSpot support) where only one driver is active per request. The package also pools connections to avoid redundant instantiation.
What’s the effort to migrate an existing custom manager to Laravel Manager?
Refactor your monolithic manager into driver classes implementing `ManagerInterface`. Update your service bindings to use the new manager pattern. Most logic (e.g., connection pooling) is handled by Laravel Manager, but driver-specific code must be rewritten. Test thoroughly, especially for edge cases like reconnection.
Are there built-in retry mechanisms or connection health checks?
No, Laravel Manager is a low-level abstraction. You’ll need to implement retry logic (e.g., using Laravel’s `retry()` helper) or health checks in your drivers. For observability, integrate with Laravel Horizon or Sentry to log connection failures or performance metrics.
How do I test a driver built with Laravel Manager?
Mock the manager’s `connect()` method in your tests to return a stubbed driver instance. Use Laravel’s `Mockery` or PHPUnit’s `createMock()` to simulate connections. Test driver-specific logic separately, then verify the manager resolves the correct driver based on configuration.
Is Laravel Manager suitable for real-time systems (e.g., WebSockets) where connections must persist?
While the package supports connection pooling, real-time systems may need additional logic to handle persistent connections. Avoid relying solely on Laravel’s request lifecycle for connection management. Consider using Laravel’s `app()->singleton()` to force connection reuse or implement a custom connection handler.
Can third-party packages extend Laravel Manager with new drivers?
Yes, third-party drivers can be registered via `extend()` or by publishing configuration. Enforce version compatibility by checking Laravel Manager’s version in your package’s `composer.json` constraints. Document your driver’s requirements clearly to avoid runtime conflicts.
What’s the difference between Laravel Manager and Laravel’s built-in Filesystem or Queue drivers?
Laravel Manager is a *generic* abstraction for any driver-based service (e.g., payment gateways, analytics tools), while Filesystem or Queue drivers are *specialized* for storage or job processing. Use Manager when you need interchangeable backends with custom logic; use built-in drivers for Laravel’s native integrations.
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi