LoginSignup
3
4

More than 5 years have passed since last update.

php note

Last updated at Posted at 2016-02-08

composer

curl -sS https://getcomposer.org/installer | php

How-to
http://tech.basicinc.jp/php/2013/08/18/php_composer/

predis

composer.json
{
"require": {
  "predis/predis": "*"
}
}

./composer.phar install

test-redis.php
<?php
require 'vendor/autoload.php';

$client = new Predis\Client();
$client->set('foo', 'bar');
$value = $client->get('foo');
print $value;

php test-redis.php

predis & replication

<?php
require 'vendor/autoload.php';

$parameters = ['tcp://server-1?alias=master',
               'tcp://server-2?alias=slave-01'];
$options    = ['replication' => true];

$client = new Predis\Client($parameters, $options);
$client->set('foo', 'bar');
print $value;

more samples
https://github.com/nrk/predis/tree/v1.0/examples

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4