maatify/infra-drivers

Pure infrastructure driver builders constructed from explicit, typed, readonly configuration objects. No environment access. No adapters. No runtime magic.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/maatify/infra-drivers

v1.0.0 2025-12-18 21:15 UTC

This package is auto-updated.

Last update: 2025-12-18 21:18:10 UTC


README

Maatify.dev

Version PHP PHP Version

Build

Monthly Downloads Total Downloads

Stars License Status

PHPStan Coverage

Changelog Security

maatify/infra-drivers

Pure infrastructure driver builders for PHP.

maatify/infra-drivers is a low-level infrastructure library responsible for constructing real native drivers (PDO, Redis, MongoDB, etc.) from explicit, typed, readonly configuration objects.

This package exists to strictly separate driver construction from application bootstrap logic, adapters, and domain concerns.

What this library is

  • Builds real infrastructure drivers
  • Accepts explicit configuration DTOs
  • Performs deterministic validation
  • Throws typed infrastructure exceptions
  • Has zero environment awareness

What this library is NOT

This package does not:

  • Read environment variables
  • Use dotenv or env loaders
  • Provide DI containers or service locators
  • Wrap adapters or expose unified APIs
  • Perform runtime detection or switching
  • Implement retries, pooling, or lifecycle management
  • Make logging or monitoring decisions

Any such behavior is considered a design violation.

Architectural position

Application
   ↓
maatify/bootstrap        (env → config wiring)
   ↓
Configuration DTOs
   ↓
maatify/infra-drivers   (driver construction only)
   ↓
Native drivers
   ↓
maatify/data-adapters   (wrappers only)

Design status

  • Architecture: LOCKED
  • Scope: LOCKED
  • Versioning: Semantic Versioning (SemVer)

Public API changes require a major version bump.

Quick Start

maatify/infra-drivers is a low-level infrastructure wiring library.

It builds real native drivers from explicit configuration DTOs without reading environment variables or relying on DI containers.

Example: MySQL using PDO

use Maatify\InfraDrivers\Config\MySQL\MySQLConfigDTO;
use Maatify\InfraDrivers\Builder\MySQL\MySQLDriverBuilder;

$config = new MySQLConfigDTO(
    dsn: 'mysql:host=localhost;dbname=test_db;charset=utf8mb4',
    username: 'user',
    password: 'password'
);

$builder = new MySQLDriverBuilder();

/** @var PDO $pdo */
$pdo = $builder->build($config);

This example demonstrates pure wiring only:

  • No environment loading
  • No service container
  • No abstraction layer

Usage Examples

This repository includes standalone executable examples demonstrating correct usage for all supported drivers.

Available examples:

  • MySQL (PDO)
  • MySQL (Doctrine DBAL)
  • Redis (ext-redis)
  • Redis (Predis)
  • MongoDB

📁 See the full list in examples/

⚠️ These examples are for reference only and are not production bootstraps.

One-line identity

Build real infrastructure drivers from explicit configuration objects — nothing more, nothing less.

🪪 License

MIT License © Maatify.dev — Free to use, modify, and distribute with attribution.

👤 Author

Engineered by Mohamed Abdulalim (@megyptm) Backend Lead & Technical Architect — https://www.maatify.dev

🤝 Contributors

Special thanks to the Maatify.dev engineering team and all open-source contributors.

Contributions are welcome. Please read the Contributing Guide before opening a PR.

Built with ❤️ by Maatify.dev — Infrastructure-first PHP libraries