phprest / phprest-api-blueprint-sample-project
Phprest Sample Project.
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- jsor/stack-jwt: 2.0.0
- namshi/jose: ~6.0
- phprest/phprest: dev-master
- phprest/phprest-service-orm: dev-master
- phprest/phprest-service-request-filter: dev-master
- phprest/phprest-service-validator: dev-master
This package is not auto-updated.
Last update: 2025-01-04 19:37:27 UTC
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:
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;
}