Context to FcPhp Application. Autoload Context inside packages with cache using FcPhp Cache and FcPhp Autoload
Composer:
$ composer require 00f100/fcphp-context
or add in composer.json
{
"require": {
"00f100/fcphp-context": "*"
}
}
<?php
/**
* Construct instance of Context
*
* @param array $context Context to apply
* @return void
*/
$context = new Context(array $context = []);
<?php
use FcPhp\Context\Context;
$context = [
'cache' => [
'file' => 'tests/var/cache',
]
];
$context = new Context($context);
// Print
// tests/var/cache
echo $context->get('cache.file');
<?php
use FcPhp\Context\Context;
use FcPhp\Autoload\Autoload;
use FcPhp\Cache\Facades\CacheFacade;
$context = [
'cache' => [
'file' => 'tests/var/cache',
]
];
$context = new Context($context);
$vendorPath = 'vendor/*/*/config';
$autoload = new Autoload();
$cache = CacheFacade::getInstance('tests/var/cache');
$context->autoload($vendorPath, $autoload, $cache);