PHPackages                             comphp/drivers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. comphp/drivers

Abandoned → [comphp/extensible](/?search=comphp%2Fextensible)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

comphp/drivers
==============

Allows for drivers to be dynamically managed

v0.1.1(2y ago)218MITPHPPHP ^8.3

Since Feb 17Pushed 2y agoCompare

[ Source](https://github.com/commonphp/drivers)[ Packagist](https://packagist.org/packages/comphp/drivers)[ RSS](/packages/comphp-drivers/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

CommonPHP Driver Management Library
===================================

[](#commonphp-driver-management-library)

The CommonPHP Driver Management Library provides a robust framework for managing driver implementations in PHP applications. By leveraging attributes and contracts, it offers a flexible system to register, enable, and utilize various drivers seamlessly within your projects.

Features
--------

[](#features)

- **Flexible Driver Configuration**: Configure drivers using PHP 8 Attributes or by specifying driver contracts.
- **Dynamic Driver Support Checking**: Determine if a class is supported as a driver based on its configuration.
- **Driver Instantiation**: On-demand driver instantiation managed by the CommonPHP Service Management framework, ensuring dependency injection and singleton management.
- **Comprehensive Exception Handling**: Detailed exception handling for configuration errors, unsupported drivers, and instantiation issues.

Installation
------------

[](#installation)

Use Composer to integrate the Driver Management Library into your project:

```
composer require comphp/drivers
```

Configuration
-------------

[](#configuration)

### Define Driver Contracts or Attributes

[](#define-driver-contracts-or-attributes)

Implement `DriverContract` for interface/abstract class-based drivers or use `DriverAttributeContract` to mark drivers with attributes.

### Register and Configure DriverManager

[](#register-and-configure-drivermanager)

```
use CommonPHP\Drivers\DriverManager;
use CommonPHP\Drivers\ServiceProviders\DriverManagerServiceProvider;
use CommonPHP\ServiceManagement\ServiceManager;

// Initialize ServiceManager and register DriverManagerServiceProvider
$serviceManager = new ServiceManager();
$serviceManager->providers->registerProvider(DriverManagerServiceProvider::class);

// Retrieve an instance of DriverManager
$driverManager = $serviceManager->get(DriverManager::class);

// Configure DriverManager with an attribute or contract class
$driverManager->configure(
    attributeClass: YourDriverAttribute::class,
    contractClass: YourDriverContract::class
);
```

Usage
-----

[](#usage)

### Enable a Driver

[](#enable-a-driver)

Once a driver meets the configured criteria (attribute or contract), enable it using:

```
$driverManager->enable(YourDriverClass::class);
```

### Utilize an Enabled Driver

[](#utilize-an-enabled-driver)

Retrieve and use an enabled driver:

```
$driver = $driverManager->get(YourDriverClass::class);
$driver->performAction();
```

Contributing
------------

[](#contributing)

Contributions to the CommonPHP Driver Management Library are welcome. Please follow the contribution guidelines provided in the repository for submitting pull requests or issues.

License
-------

[](#license)

This library is released under the MIT license. See [LICENSE](LICENSE) for details.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

867d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5991e71fdfcd1bc709602e9d809bded7c12649ba25084cc6f715caf45e2e52c1?d=identicon)[tlmcclatchey](/maintainers/tlmcclatchey)

---

Top Contributors

[![tlmcclatchey](https://avatars.githubusercontent.com/u/112527648?v=4)](https://github.com/tlmcclatchey "tlmcclatchey (3 commits)")

---

Tags

commonphpdriver-managementmodularmodular-architectureopen-sourcephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/comphp-drivers/health.svg)

```
[![Health](https://phpackages.com/badges/comphp-drivers/health.svg)](https://phpackages.com/packages/comphp-drivers)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
