Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Flexible and modern PHP configuration library built for performance, extendability, and lazy-loading behavior.

License

php-fast-forward/config

Repository files navigation

FastForward Config

FastForward Config is a flexible and modern PHP configuration library built for performance, extendability, and lazy-loading behavior. It supports dot-notation keys, recursive directory loading, Laminas-compliant configuration providers, and optional PSR-16 caching.


✨ Features

  • πŸ”‘ Dot notation access: config->get('app.env')
  • πŸ“ Load from arrays, directories, or providers
  • ♻️ Lazy-loading with __invoke()
  • 🧩 Aggregation of multiple sources
  • πŸ—‚ Recursive directory support
  • πŸ’Ύ Optional PSR-16 compatible caching
  • πŸ”Œ Compatible with Laminas ConfigProviders

πŸ“¦ Installation

composer require fast-forward/config

πŸš€ Quick Start

Load configuration from multiple sources:

use FastForward\Config\{config, configDir, configCache};
use Symfony\Component\Cache\Simple\FilesystemCache;
$config = config(
 ['app' => ['env' => 'production']],
 __DIR__ . '/config',
 \Vendor\Package\ConfigProvider::class
);
echo $config->get('app.env'); // "production"

Cache configuration using PSR-16:

$cache = new FilesystemCache();
$config = configCache(
 cache: $cache,
 ['foo' => 'bar']
);
echo $config->get('foo'); // "bar"

Load from a recursive directory:

$config = configDir(__DIR__ . '/config', recursive: true);

Use Laminas-style providers:

$config = configProvider([
 new Vendor\Package\Provider1(),
 new Vendor\Package\Provider2(),
]);

πŸ§ͺ Access & Mutation

$config->set('db.host', 'localhost');
echo $config->get('db.host'); // "localhost"
$config->has('app.debug'); // true/false
print_r($config->toArray());

πŸ“ Directory Structure Example

config/
β”œβ”€β”€ app.php
β”œβ”€β”€ db.php
└── services/
 └── mail.php

🧰 API Summary

  • config(...$configs): ConfigInterface
  • configCache(CacheInterface $cache, ...$configs): ConfigInterface
  • configDir(string $dir, bool $recursive = false, ?string $cache = null): ConfigInterface
  • configProvider(iterable $providers, ?string $cache = null): ConfigInterface

πŸ›‘ License

MIT Β© 2025 Felipe SayΓ£o Lobato Abreu

About

Flexible and modern PHP configuration library built for performance, extendability, and lazy-loading behavior.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /