willgarcia / silex-api-boilerplate
Silex应用程序,用于开始使用您的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: 2024-09-24 07:57:42 UTC
README
silex-api-boilerplate
在Silex应用程序中构建RESTful API的起点。
先决条件
- PHP >=5.4
- Grunt-cli >= 0.1.6
组件
本项目使用以下组件
- Silex应用程序
- HATEOAS API
- 【API密钥认证】
- Monolog作为服务提供者
- 使用Behat 3进行功能测试
API
提供的API作为一个示例,并支持HAL格式。
API端点(见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
安装
$ composer create-project willgarcia/silex-api-boilerplate my-new-api -s dev
$ npm install
$ grunt
开发
仅用于开发目的,您可以通过启动PHP内置的web服务器来提供API服务
$ cp app/env_dev.php-dist app/env_dev.php
$ API_ENV=dev php -S 0.0.0.0:4000 web/index.php
请参阅https://php.ac.cn/manual/en/features.commandline.webserver.php
从这里,您可以访问此URL:https://:4000
测试
$ bin/behat tests/functional/features/
许可证
Silex-api-boilerplate采用MIT许可证发布。有关详细信息,请参阅捆绑的LICENSE文件。