willgarcia / silex-api-boilerplate
Silex application for getting started with your API.
0.1.0
2014-08-04 06:57 UTC
Requires
- php: >=5.4
- dflydev/hawk: 1.0.*@dev
- dflydev/stack-authentication: 1.0.*@dev
- dflydev/stack-firewall: 1.0.*@dev
- dflydev/stack-hawk: 1.0.*@dev
- monolog/monolog: >=1.0.0
- silex/silex: ~1.0
- stack/builder: 1.0.*@dev
- willdurand/hateoas: ~2.0
Requires (Dev)
- behat/behat: ~3.0
- behat/mink: ~1.6@dev
- behat/mink-browserkit-driver: ~1.2@dev
- behat/mink-extension: 2.0.*@dev
- behat/mink-goutte-driver: 1.1.*@dev
- camspiers/json-pretty: 1.0.*
- fabpot/php-cs-fixer: 0.*
- phpmd/phpmd: 2.*
This package is not auto-updated.
Last update: 2025-03-25 10:25:22 UTC
README
silex-api-boilerplate
A starting point for building your RESTful API within a Silex application.
Prerequisites
- PHP >=5.4
- Grunt-cli >= 0.1.6
Components
This project uses the following components:
- Silex application
- HATEOAS API
- [API key authentication]
- Monolog as a service provider
- Functional tests with Behat 3
API
The provided API stands as an example, and supports the HAL format.
API Endpoints (see app/routing.php
) :
/api # API entry point ; secured route
/api/errors # API errors list ; secured route
/api/errors/{code} # API error description ; secured route
/api/customers # Customers list ; secured route
/api/customers/{cid} # Customer informations ; secured route
/api/customers/{cid}/licenses # Customer's licenses list ; secured route
/api/customers/{cid}/licenses/{lid} # Customer license informations ; secured route
Installation
$ composer create-project willgarcia/silex-api-boilerplate my-new-api -s dev
$ npm install
$ grunt
Development
For development purposes only, you can serve the API by starting a PHP built-in web server:
$ cp app/env_dev.php-dist app/env_dev.php
$ API_ENV=dev php -S 0.0.0.0:4000 web/index.php
See http://php.net/manual/en/features.commandline.webserver.php
From here, you can access to this URL: http://localhost:4000
Tests
$ bin/behat tests/functional/features/
License
Silex-api-boilerplate is released under the MIT License. See the bundled LICENSE file for details.