Skip to content
A base for building REST APIs on Slim3
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
spec/Langsyne
src
README.md
composer.json
composer.lock

README.md

Langsyne

A base for building REST APIs on Slim3

Usage example

$app = new \Langsyne\App();

$c = $app->getContainer();

$c['datastore.items'] = function ($c) {
    return new Langsyne\DataStores\FileSystemDataStore();
};

$c['renderer'] = function ($c) {
    return new Langsyne\Renderers\JsonRenderer();
};

$c['validator.item'] = function ($c) {
    return new Langsyne\Validators\NullValidator();
};

$homeResource = new Langsyne\Resources\HttpResource();
$app->addResource('home', '/', $homeResource)
    ->addData("message", "Welcome")
    ->addLink("items")
    ->addLink("item");

$itemCollection = new Langsyne\Resources\HttpCollection('item', $c['datastore.items'], $c['validator.item']);
$app->addResource('items', '/items', $itemCollection);

$itemResource = new Langsyne\Resources\HttpResource($c['datastore.items'], $c['validator.item']);
$app->addResource('item', '/items/{id}', $itemResource)
    ->addLink("home", "up");

$app->run();
You can’t perform that action at this time.