phprest/phprest-api-blueprint-sample-project
Composer 安装命令:
composer create-project phprest/phprest-api-blueprint-sample-project
包简介
Phprest Sample Project.
关键字:
README 文档
README
Requirements
- Composer
- Php 5.4 or latest
- MySql 5.x
- NodeJS for API and Documentation Testing
- Hercule for creating API Blueprint based documentation
- Apiary client for creating API Blueprint based documentation
- Dredd for testing API Blueprint based documentation
Installation
1. Create project
composer -sdev create-project phprest/phprest-api-blueprint-sample-project /path/to/your/project
2. Configure your database settings
In app/config/orm.php set your database credentials.
3. Create database
create database tesselboard collate=utf8mb4_unicode_ci;
4. Database migrations
(from the root of your project dir)
vendor/bin/phprest-service-orm migrations:migrate
5. Database fixtures
(from the root of your project dir)
vendor/bin/phprest-service-orm fixtures:set
6. Storage dir
(from the root of your project dir)
Storage dir (app/storage) has to be writeable by the web server.
Create API Documentation
(from the root of your project dir)
hercule blueprint/0.1/blueprint.md -o public/blueprint.md;
apiary preview --path=public/blueprint.md --output=public/api_documentation.html
Testing API Documentation
vendor/bin/phprest-service-orm fixtures:set
dredd public/blueprint.md http://localhost/
API testing (spec tests)
(from the root of your project dir)
cd specs
npm install
cd ..
vendor/bin/phprest-service-orm fixtures:set
specs/node_modules/jasmine-node/bin/jasmine-node --verbose specs/tests
List your routes
(from the root of your project dir)
vendor/bin/phprest routes:get
You should get something like this:
| Method | Route | Handler |
|---|---|---|
| OPTIONS | /{version:any}/camera | \Api\Camera\Controller\Camera::options |
| GET | /{version:any}/camera | \Api\Camera\Controller\Camera::get |
| POST | /{version:any}/camera | \Api\Camera\Controller\Camera::post |
| GET | /{version:any}/temperatures | \Api\Temperature\Controller\Temperature::getAll |
| POST | /{version:any}/temperatures | \Api\Temperature\Controller\Temperature::post |
| OPTIONS | /{version:any}/temperatures | \Api\Temperature\Controller\Temperature::optionsAll |
| OPTIONS | /{version:any}/temperatures/{id:number} | \Api\Temperature\Controller\Temperature::options |
| GET | /{version:any}/temperatures/{id:number} | \Api\Temperature\Controller\Temperature::get |
| DELETE | /{version:any}/temperatures/{id:number} | \Api\Temperature\Controller\Temperature::delete |
Nginx sample configuration
server {
listen 80;
server_name localhost;
root /var/www/application/public;
index index.php;
location / {
try_files $uri $uri/ @rewrite;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @rewrite {
rewrite ^ /index.php;
}
error_log /var/log/nginx/application_error.log;
}
phprest/phprest-api-blueprint-sample-project 适用场景与选型建议
phprest/phprest-api-blueprint-sample-project 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 06 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「rest」 「restful」 「phprest」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 phprest/phprest-api-blueprint-sample-project 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phprest/phprest-api-blueprint-sample-project 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 phprest/phprest-api-blueprint-sample-project 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
This is a restful api to onesignal.
A RESTful API package for the Laravel and Lumen frameworks.
Simple and lightweight HTTP client based cURL
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-29