Download the PHP package beryllium/silex-cache-provider without Composer

On this page you can find all versions of the php package beryllium/silex-cache-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silex-cache-provider

Silex Cache Provider

SilexCacheProvider is configurable to provide client interfaces for Memcache, APC, or a file-based cache.

Installation

Run composer require beryllium/silex-cache-provider or add to your composer.json:

"require": {
    "beryllium/silex-cache-provider": "*"
}

Currently, the provider is only available with a minimum stability of "dev".

Configuration

Memcache

Register the provider using Memcache (requires installation of the PHP memcache extension):

$app->register(
    new Beryllium\SilexCacheProvider\SilexCacheProvider(),
    array(
        'be_cache.type' => 'memcache',
        'be_cache.host' => '127.0.0.1',
        'be_cache.port' => 11211,
    )
);

The above settings are the provider defaults, so you can actually just do the following if that is your configuration:

$app->register(new Beryllium\SilexCacheProvider\SilexCacheProvider());

File Cache

This option requires a local folder with write access. The be_cache service will use the folder to store serialized data from PHP.

$app->register(
    new Beryllium\SilexCacheProvider\SilexCacheProvider(),
    array(
        'be_cache.type' => 'filecache',
        'be_cache.path' => __DIR__ . '/cache'
    )
);

APC Cache

This option requires the APC extension to be active.

$app->register(
    new Beryllium\SilexCacheProvider\SilexCacheProvider(),
    array(
        'be_cache.type' => 'apc'
    )
);

Usage

Three methods are exposed by the cache service. Set, Get, and Delete.

Set

This method takes three parameters: Key Name, Data, and Time-To-Live (in seconds).

To store the variable $data for 5 minutes, you would use:

$app['be_cache']->set('key_name', $data, 300);

Get and Delete

These methods only take one parameter: Key Name.

$data = $app['be_cache']->get('key_name');
// ...
$app['be_cache']->delete('key_name');

Additional Tips

Prefix

You may want to share your Memcache instance with other processes. In this scenario, you would want to namespace all of your application's keys so they won't conflict.

This can be done by specifying a prefix in your settings at registration:

'be_cache.prefix' => 'example_prefix|';

Get Client

You can retrieve the client from the service two ways:

$client = $app['be_cache.client'];
// or
$client = $app['be_cache']->getClient();

All versions of silex-cache-provider with dependencies

PHP Build Version
Package Version
Requires php Version >5.3.8
silex/silex Version *
beryllium/cache Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package beryllium/silex-cache-provider contains the following files

Loading the files please wait ....