Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marmelab/microrest.php
A micro web application providing a REST API on top of any relational database, using Silex and Doctrine DBAL
https://github.com/marmelab/microrest.php
Last synced: about 1 month ago
JSON representation
A micro web application providing a REST API on top of any relational database, using Silex and Doctrine DBAL
- Host: GitHub
- URL: https://github.com/marmelab/microrest.php
- Owner: marmelab
- License: mit
- Archived: true
- Created: 2014-12-15T09:58:20.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-04-17T11:30:05.000Z (over 5 years ago)
- Last Synced: 2024-04-13T02:08:37.305Z (8 months ago)
- Language: PHP
- Homepage: http://marmelab.com/blog/2015/01/05/introducing-microrest-raml-api-in-silex.html
- Size: 370 KB
- Stars: 186
- Watchers: 31
- Forks: 23
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rest - Microrest - Micro-web application providing a REST API on top of any relational database. (Servers / PHP)
README
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](http://marmelab.com/blog/2015/01/05/introducing-microrest-raml-api-in-silex.html).
## What is RAML ?
[RESTful API Modeling Language (RAML)](http://raml.org/) 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](http://api-portal.anypoint.mulesoft.com/raml/api-designer).
## Installation
To install microrest.php library, run the command below and you will get the latest version:
```bash
composer require marmelab/microrest "~1.0@dev"
```Enable `ServiceController`, `Doctrine` and `Microrest` service providers in your application:
```php
$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:
```bash
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:
```bash
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](https://github.com/marmelab/ng-admin) backend administration at the url: `http://localhost:8888/admin`
## License
microrest.php is licensed under the [MIT License](LICENSE), courtesy of [marmelab](http://marmelab.com).