tonybogdanov / class-config
Per-object configuration from class annotations
Requires
- php: ^7.1
- doctrine/annotations: ^1.6
- nette/php-generator: 3.1
Requires (Dev)
- apigen/apigen: dev-master
- php-coveralls/php-coveralls: 2.0.0
- phpunit/phpunit: 6.5.5
This package is auto-updated.
Last update: 2020-08-18 11:55:15 UTC
README
Per-object configuration from class annotations in PHP.
Installation
Install via Composer:
composer require tonybogdanov/class-config
Configuration
Configure the library by calling ClassConfig::register()
, choosing a cache directory, cache strategy and optionally a config class namespace, once and only once prior to using any of the features.
Add an autoload PSR-4 entry in composer.json
and point the ClassConfig\Cache\
namespace (or the one you've configured) to the cache folder you chose.
Until doctrine/annotations
reaches version 2.0
you'll also need to manually register the composer autoloader with the annotations' registry:
$loader = include 'vendor/autoload.php'; \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$loader, 'loadClass']);
Alternatively you can try indigophp/doctrine-annotation-autoload
.
Testing
Run the tests:
./bin/run-tests.sh
Usage
TODO