2017 © Pedro Peláez
 

project silex-simple-rest-swagger

A simple silex skeleton for rest api with swagger documentation

image

vjeantet/silex-simple-rest-swagger

A simple silex skeleton for rest api with swagger documentation

  • Tuesday, June 3, 2014
  • by vjeantet
  • Repository
  • 1 Watchers
  • 1 Stars
  • 54 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 104 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Silex Simple REST with its auto generated documentation with Swagger

License Latest Stable Version Dependency Status Build Status, (*1)

A simple silex skeleton application for writing RESTful API. Based on the silex-simple-rest github repo from Alessandro Arnodo. silex-simple-rest-swagger is a fork, which add a swagger REST API Documentation, auto generated., (*2)

This project wants to be a starting point to writing scalable and maintainable REST api with Silex PHP micro-framework, (*3)

Continuous Integration is provided by Travis-CI., (*4)

How do I run it?

From this folder run the following commands to install the php and bower dependencies, import some data, and run a local php server., (*5)

You need at least php 5.4.*** with **SQLite extension enabled and Composer, (*6)

composer install 
sqlite3 app.db < resources/sql/schema.sql
php -S 0:9001 -t web/

You can install the project also as a composer project, (*7)

    composer create-project vjeantet/silex-simple-rest-swagger

Your api is now available at http://localhost:9001/api/v1., (*8)

You can visualise your api documentation going to : http://localhost:9001/swagger-ui//, (*9)

Run tests

Some tests were written, and all CRUD operations are fully tested :), (*10)

From the root folder run the following command to run tests., (*11)

vendor/bin/phpunit 

What you will get

The api will respond to, (*12)

GET  ->   http://localhost:9001/api/v1/notes
POST ->   http://localhost:9001/api/v1/notes
POST ->   http://localhost:9001/api/v1/notes/{id}
DELETE -> http://localhost:9001/api/v1/notes/{id}

Your request should have 'Content-Type: application/json' header. Your api is CORS compliant out of the box, so it's capable of cross-domain communication., (*13)

Try with curl:, (*14)

#GET
curl http://localhost:9001/api/v1/notes -H 'Content-Type: application/json' -w "\n"

#POST (insert)
curl -X POST http://localhost:9001/api/v1/notes -d '{"note":"Hello World!"}' -H 'Content-Type: application/json' -w "\n"

#POST (update)
curl -X POST http://localhost:9001/api/v1/notes/1 -d '{"note":"Uhauuuuuuu!"}' -H 'Content-Type: application/json' -w "\n"

#DELETE
curl -X DELETE http://localhost:9001/api/v1/notes/1 -H 'Content-Type: application/json' -w "\n"

What's under the hood

Take a look at the source code, it's self explanatory :) More documentation and info about the code will be available soon., (*15)

Under the resources folder you can find a .htaccess file to put the api in production., (*16)

Contributing

Fell free to contribute, fork, pull request, hack. Thanks!, (*17)

Author

License

see LICENSE file., (*20)

The Versions

03/06 2014

dev-master

9999999-dev http://github.com/vjeantet/silex-simple-rest

A simple silex skeleton for rest api with swagger documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alessandro Arnodo

api framework rest silex swagger

02/06 2014
01/06 2014
28/11 2013

v2.1.0

2.1.0.0 http://github.com/vesparny/silex-simple-rest

A simple silex skeleton for rest api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alessandro Arnodo

api framework rest silex

24/11 2013

v2.0.1

2.0.1.0 http://github.com/vesparny/silex-simple-rest

A simple silex skeleton for rest api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alessandro Arnodo

api framework rest silex

24/11 2013

v2.0.2

2.0.2.0 http://github.com/vesparny/silex-simple-rest

A simple silex skeleton for rest api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alessandro Arnodo

api framework rest silex

24/11 2013

v2.0.0

2.0.0.0 http://github.com/vesparny/silex-simple-rest

A simple silex skeleton for rest api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alessandro Arnodo

api framework rest silex