Skip to content
This repository has been archived by the owner. It is now read-only.
A micro web application providing a REST API on top of any relational database, using Silex and Doctrine DBAL
PHP RAML JavaScript HTML Makefile
Branch: master
Clone or download
Latest commit c9e0e95 Apr 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/ng-admin Configure api doc route to ng-admin example app Jan 20, 2015
src Add api doc route Jan 20, 2015
tests Fix tests Jan 20, 2015
views
web Add api doc route Jan 20, 2015
.gitattributes Add ng-admin with Silex API application example Dec 16, 2014
.gitignore Move test db file to -dist + update makefile and .travis.yml Jan 19, 2015
.travis.yml Only run one travis build on PR Sep 25, 2015
LICENSE Add license Dec 17, 2014
README.md Update README.md Apr 17, 2019
composer.json Fix php-raml-parser dependency version Sep 25, 2015
composer.lock Fix php-raml-parser dependency version Sep 25, 2015
makefile Move test db file to -dist + update makefile and .travis.yml Jan 19, 2015
phpunit.xml.dist Define php >=5.4 requirement and add first simple test Jan 19, 2015

README.md

archived Archived Repository
This code is no longer maintained. Feel free to fork it, but use it at your own risks.

Marmelab Microrest

Microrest is a Silex provider to setting up a REST API on top of a relational database, based on a YAML (RAML) configuration file.

Check out the launch post.

What is RAML ?

RESTful API Modeling Language (RAML) is a simple and succinct way of describing practically-RESTful APIs. It encourages reuse, enables discovery and pattern-sharing, and aims for merit-based emergence of best practices.

You can easily set up a RAML file from API Designer.

Installation

To install microrest.php library, run the command below and you will get the latest version:

composer require marmelab/microrest "~1.0@dev"

Enable ServiceController, Doctrine and Microrest service providers in your application:

$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
    'db.options' => array(
        'driver'   => 'pdo_sqlite',
        'path'     => __DIR__.'/app.db',
    ),
));
$app->register(new Marmelab\Microrest\MicrorestServiceProvider(), array(
    'microrest.config_file' => __DIR__ . '/api.raml',
));

You need to give the path to the RAML file describing your API. You can find an example into the tests/fixtures directory.

Then, browse your new API REST on the url defined in the baseUrl configuration of your RAML api file.

Tests

Run the tests suite with the following commands:

make install
make test

Demo

You can find a complete demo application in examples/ng-admin. You just need 2 commands to install and run it:

make install-demo
make run-demo

Play with the Silex demo API at the url: http://localhost:8888/api

Explore the API using ng-admin backend administration at the url: http://localhost:8888/admin

License

microrest.php is licensed under the MIT License, courtesy of marmelab.

You can’t perform that action at this time.