PHPackages                             illchuk/zend-config-cacheproof - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. illchuk/zend-config-cacheproof

ActiveLibrary[Caching](/categories/caching)

illchuk/zend-config-cacheproof
==============================

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

v0.1.1(8y ago)039MITPHPPHP ^5.5|^7.0

Since Oct 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dillchuk/ZendConfigCacheproof)[ Packagist](https://packagist.org/packages/illchuk/zend-config-cacheproof)[ Docs](https://github.com/dillchuk/ZendConfigCacheproof)[ RSS](/packages/illchuk-zend-config-cacheproof/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

ZendConfigCacheproof
====================

[](#zendconfigcacheproof)

[![Build Status](https://camo.githubusercontent.com/62f9c9912c64404c694dc9cb6078716e265fad35109ba069f283c93b4d18c8b4/68747470733a2f2f7472617669732d63692e6f72672f64696c6c6368756b2f5a656e64436f6e666967436163686570726f6f662e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dillchuk/ZendConfigCacheproof)

Purpose
-------

[](#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.

Install with `composer require illchuk/zend-config-cacheproof`.

Then reference in `modules.config.php`:

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

```

Easy Start
----------

[](#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.

Useful Start
------------

[](#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:

```
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.

Removing Conflicting Config
---------------------------

[](#removing-conflicting-config)

You may want to remove config too. This can be done as follows:

```
