Skip to content

Repository files navigation

Ration

What is Ration

Ration is a very simple PHP library for interacting with Redis servers.

Why build another library?

The current PHP libraries are overly complicated for something that should be very quick and simple. There are some great PHP extensions for communicating with Redis, however these need to be compiled and enabled on your machine which isn't always practical. This library is simple, lightweight and portable.

Requirements

  • PHP 5.3.3+

Installation

We recommend using Composer to add ration to your project. Simply add this to your composer config:

{"require": {"versionable/ration": "1.0.0"}}

Usage

Pinging a remote server

$address = newTCP('10.0.0.1', 6379);
$connection = newConnection($address);
$client = newClient($connection);
$request = newRequest(newPingCommand());
$response = $client->send($request);

Set then get a key

$address = newTCP('10.0.0.1', 6379);
$connection = newConnection($address);
$client = newClient($connection);
$request = newRequest(newSetCommand('key', 'value'));
$client->send($request);
$request = newRequest(newGetCommand('key'));
$response = $client->send($response);

TODO

  • Complete documentation of current API
  • Implement remaining commands

About

A very simple redis client

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages