fg/essence-interfaces

There is no license information available for the latest version (2.4.0) of this package.

Provides interfaces to use external libraries with Essence.

2.4.0 2014-03-29 12:57 UTC

This package is auto-updated.

Last update: 2024-11-24 03:59:04 UTC


README

A set of interfaces to use third-party libraries within Essence.

Usage

Here is how to use a Doctrine cache throughout the application:

$Essence = Essence\Essence::instance([
	'Cache' => Essence\Di\Container::unique( function( ) {
		return new Essence\Cache\Engine\Doctrine(
			new Doctrine\Common\Cache\FilesystemCache( 'path/to/cache/directory' )
		);
	})
]);

Cache interfaces

CakePHP

$Cache = new Essence\Cache\Engine\Cake( 'configuration' );

Doctrine

$Cache = new Essence\Cache\Engine\Doctrine(
	new Doctrine\Common\Cache\FilesystemCache( 'path/to/cache/directory' ),
	$ttl
);

Zend

$Cache = new Essence\Cache\Engine\Zend(
	Zend\Cache\StorageFactory::adapterFactory( 'apc' )
);

HTTP interfaces

CakePHP

$Http = new Essence\Http\Client\Cake( new HttpSocket( ));

Log interfaces

CakePHP

$Log = new Essence\Log\Logger\Cake( 'scope' );

PSR/Monolog

$Log = new Essence\Log\Logger\Psr( new CustomPsrLogger( ));
$Monolog = new Monolog\Logger( 'essence' );
$Monolog->pushHandler(
	new Monolog\Handler\StreamHandler( 'path/to/log/file' )
);

$Log = new Essence\Log\Logger\Psr( $Monolog );