Skip to content
This repository

A simple redis-backed repository for php: a no-sql orm.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 src
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 composer.json
Octocat-spinner-32 phpdoc.xml
README.md

rstore

A simple redis-backed repository for php.

usage

<?php

require_once 'vendor/autoload.php';

$connection = new Predis\Client(
    array(
        'host' => '127.0.0.1',
        'port' => '6379'
    )
);

$adapter = new Rstore\ConnectionAdapter\Predis($connection);

$models = yaml_parse(
"user:
    id:
        type: integer
        index: true
    full_name:
        type: string
        maxlength: 255
        required: true
    username:
        type: string
        index: true
    password:
        type: string
        required: true
    email_addresses:
        type: array
    bio:
        type: string");

$repo = new Rstore\Repository($adapter, $models);

$user = $repo->create('user');
$user->full_name = "John Doe";
$user->username = "john_doe";
$user->password = "...";
$user->email_addresses = array(
    "john.doe@provider.net",
    "john.doe@another-provider.com"
);

$repo->save($user);

$loadedUser = $repo->loadByIndex('user', 'id', $user->id);

echo $loadedUser == $user; // true

docs

Something went wrong with that request. Please try again.