Skip to content
This repository was archived by the owner on May 16, 2026. It is now read-only.

v0.1

Choose a tag to compare

@tlmcclatchey tlmcclatchey released this 17 Feb 16:02
· 2 commits to main since this release

We are excited to announce the launch of the CommonPHP Driver Manager Library v0.1! This initial release introduces a robust framework designed to streamline the management and utilization of drivers across your PHP applications. Leveraging the power of PHP 8 attributes and interfaces, this library offers a flexible and intuitive approach to integrating various drivers, such as database connections, file storage systems, and third-party APIs, into your projects.

Features

  • Driver Identification: Utilize PHP 8 attributes or interfaces to mark classes as drivers within your application, providing a clear and concise mechanism for driver management.
  • Dynamic Configuration: Configure your driver manager to recognize drivers through either attributes, contracts, or both, allowing for versatile and dynamic setup.
  • Driver Enablement: Easily enable drivers for use within your application, ensuring that only those that meet your defined criteria are utilized.
  • Instantiation and Dependency Injection: Seamlessly integrate with the CommonPHP Service Management framework for dependency injection, allowing for automatic driver instantiation when needed.
  • Exception Handling: Comprehensive exception handling mechanisms provide clear feedback on configuration errors, unsupported drivers, and instantiation issues, facilitating easier debugging and maintenance.

Getting Started

To begin using the Driver Manager Library, install it via Composer:

composer require comphp/drivers

Configure the DriverManager with your preferred driver identification method:

use CommonPHP\Drivers\DriverManager;
use CommonPHP\ServiceManagement\ServiceManager;

$serviceManager = new ServiceManager();
$driverManager = new DriverManager();

// Configure with an attribute
$driverManager->configure(AttributeClass::class, null);

// Or configure with a contract
$driverManager->configure(null, DriverContract::class);

Enable and retrieve your drivers as needed:

$driverManager->enable(MyDriver::class);
$myDriver = $driverManager->get(MyDriver::class);

Contributing

We welcome contributions from the community! Whether it's through submitting pull requests, reporting bugs, or suggesting new features, your input is invaluable in making the Driver Manager Library even better. Please refer to our contribution guidelines for more information.

License

The CommonPHP Driver Manager Library is open-sourced software licensed under the MIT license.