mheap / Silex-Memcache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Silex-Memcache

Build Status

Requirements

This extension only works with PHP 7.1+, Silex 2 and the Memcached driver. Version 1.0.0 is compatible with Silex 1 and both the Memcache/Memcached drivers.

Installation

Install with composer:

composer require mheap/silex-memcache

Usage

Before you can use this extension you need to register it with your application. You can specify a list of servers to connect to at this point

$app->register(new SilexMemcache\MemcacheExtension(), array(
    'memcache.server' => array(
        array('127.0.0.1', 11211)
    )
));

Once the extension is registered, it'll be available as $app['memcache']:

$app->get('/', function() use($app) {
    $app['memcache']->set('my_value', 'This is an example');
    $value = $app['memcache']->get('my_value');
});

Running the tests

You'll need memcached running on port 11211 locally to run the tests. If you don't have memcached installed you can run docker-compose up to run it in a container instead.

About

License:Other


Languages

Language:PHP 88.0%Language:Shell 12.0%