Coder Social home page Coder Social logo

marmelab / microrest.php Goto Github PK

View Code? Open in Web Editor NEW
185.0 31.0 22.0 379 KB

A micro web application providing a REST API on top of any relational database, using Silex and Doctrine DBAL

Home Page: http://marmelab.com/blog/2015/01/05/introducing-microrest-raml-api-in-silex.html

License: MIT License

PHP 64.65% JavaScript 13.16% Makefile 1.55% RAML 14.11% HTML 6.53%

microrest.php's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.