2017 © Pedro Peláez
 

package fcphp-context

Context for FcPhp

image

00f100/fcphp-context

Context for FcPhp

  • Thursday, June 28, 2018
  • by 00F100
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

FcPhp Context

Context to FcPhp Application. Autoload Context inside packages with cache using FcPhp Cache and FcPhp Autoload, (*1)

Build Status codecov Total Downloads, (*2)

How to install

Composer:, (*3)

$ composer require 00f100/fcphp-context

or add in composer.json, (*4)

{
    "require": {
        "00f100/fcphp-context": "*"
    }
}

How to use

<?php
/**
 * Construct instance of Context
 *
 * @param array $context Context to apply
 * @return void
 */
$context = new Context(array $context = []);

Example

<?php

use FcPhp\Context\Context;

$context = [
    'cache' => [
        'file' => 'tests/var/cache',
    ]
];

$context = new Context($context);

// Print
// tests/var/cache
echo $context->get('cache.file');

Autoload, update Context and cache

<?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);

The Versions

28/06 2018