Releases: commonphp/drivers
Bug fixes - v0.1.1
We are pleased to announce the release of Driver Manager version 0.1.1. This release includes critical fixes enhancing the functionality and reliability of the driver support checks and the management of enabled drivers within the system. Below are the detailed changes included in this update:
Enhancements and Fixes:
-
Support Check for Both Attribute and Contract (Issue #1): The
supports
method within theDriverManager
has been updated to correctly check for both attribute and contract requirements when both are not null. This ensures a more stringent validation process, allowing the system to accurately determine if a class is supported based on the defined attribute and contract configurations. This update addresses a crucial requirement where a class must use both the attribute and contract to be considered supported, enhancing the specificity and reliability of driver support checks. -
Driver Enabled Check Using
array_key_exists
(Issue #2): We've fixed an issue in theisEnabled
andget
methods of theDriverManager
, where the check to determine if a driver is enabled was incorrectly usingisset
, which failed to recognize drivers loaded with a null value. By switching toarray_key_exists
, we ensure accurate detection of whether a driver is enabled, regardless of its current value. This fix corrects the behavior where drivers were always determined to be disabled, improving the manager's ability to accurately track and manage the state of loaded drivers.
Closing Notes:
This update addresses key aspects of the Driver Manager's functionality, making it more robust and reliable. We encourage all users to update to version 0.1.1 to benefit from these improvements.
For any issues or contributions, please visit our project repository. We appreciate your feedback and contributions to making the Driver Manager better with each release.
v0.1
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.