2017 © Pedro Peláez
 

library zend-config-cacheproof

Create *.cacheproof.php config files that skip the cache, with custom loading.

image

illchuk/zend-config-cacheproof

Create *.cacheproof.php config files that skip the cache, with custom loading.

  • Wednesday, November 1, 2017
  • by dillchuk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 31 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ZendConfigCacheproof

Build Status, (*1)

Purpose

Caching your config is nice (i.e. using 'module_listener_options' => ['config_cache_enabled' => true]), but this locks your config down tight. What if you need to tweak things a bit for, say, running tests? Enter ZendConfigCacheproof., (*2)

Install with composer require illchuk/zend-config-cacheproof., (*3)

Then reference in modules.config.php:, (*4)

return [
    ..., 'ZendConfigCacheproof', ...
];

Easy Start

In your config/autoload, create *.cacheproof.php config files. (As opposed to the usual *.global.php and *.local.php files.) These will be loaded every time., (*5)

Useful Start

You may want your configuration to change based on environment variables; install a cacheproof_loaders factory -- see config/cacheproof.global.php.dist -- like the following:, (*6)

namespace Application\Cacheproof;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use ZendConfigCacheproof\Loader\EnvironmentVariable as EnvLoader;

class LoaderFactory implements FactoryInterface {

    const GLOB_LIVE = './config/autoload/{{,*.}live}.php';
    const ENV_VAR_LIVE = 'INSTANCE_LIVE';

    public function __invoke(
    ContainerInterface $container, $requestedName, array $options = null
    ) {
        $loader = new EnvLoader(static::ENV_VAR_LIVE);
        $loader->setGlob(static::GLOB_LIVE);
        return $loader;
    }

}

Then, your ./config/autoload/{{,*.}live}.php config is live-loaded whenever environment variable INSTANCE_LIVE is true-ish., (*7)

Removing Conflicting Config

You may want to remove config too. This can be done as follows:, (*8)

<?php // in ./config/autoload/cacheproof.php

return [
    'foobar' => new \Zend\Stdlib\ArrayUtils\MergeRemoveKey, // toast it
]

The Versions

01/11 2017

dev-master

9999999-dev https://github.com/dillchuk/ZendConfigCacheproof

Create *.cacheproof.php config files that skip the cache, with custom loading.

  Sources   Download

MIT

The Requires

 

The Development Requires

cache config zf3 zend-config

14/10 2017

v0.1.1

0.1.1.0 https://github.com/dillchuk/ZendConfigCacheproof

Create *.cacheproof.php config files that skip the cache, with custom loading.

  Sources   Download

MIT

The Requires

 

The Development Requires

cache config zf3 zend-config

13/10 2017

v0.1

0.1.0.0 https://github.com/dillchuk/ZendConfigCacheproof

Create *.cacheproof.php config files that skip the cache, with custom loading.

  Sources   Download

MIT

The Requires

 

The Development Requires

cache config zf3 zend-config