dimsob / bootstrapi

This is my JSONAPI skeleton. Built using Slim 3, Eloquent, Zend-ACL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bootstrapi

This is my JSONAPI skeleton. Built using Slim 3, Eloquent, Zend-ACL

Feature

  • JWT-token authorization
  • Validation request
  • ACL role based
  • Support base CRUD operation
  • Filtering && Sorting && Pagination
  • DB migration
  • CLI-tools
  • JSONAPI negotiation
  • Generated documentation
  • Log

Inside:

Demo

Example documentation

Example client (Ember.js application)

Client repo

Requirements

  • PHP >= 5.6
  • Composer
  • MySQL / PostgreSQL
  • NodeJs && NPM && ApiDocJs (for docs generate)

Installing

  1. create new project
$ composer create-project -n -s dev pmurkin/bootstrapi my-api
  1. change config files:
$ nano config/db.php
$ nano config/params.php
$ nano app/apidoc.json # require set "url"
$ nano version.sh
  1. configure nginx

Be sure to define environment variables:

APPLICATION_ENV
SECRET_KEY

Example configuration:

server {
    listen 80 ;
    server_name     hostname;
    error_log       /path/to/nginx/logs/hostname.error.log;
    access_log      /path/to/nginx/logs/hostname.access.log;
    index           /frontend/index.html index.html;

    root   /path/to/projects/hostname;

    location ~* (.+\.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar|woff|woff2|ttf|eot|svg))$ {
        root   /path/to/projects/hostname/frontend;
        try_files       $uri =404;
    }

    location ~ /api/ {
        if (!-e $request_filename) {rewrite ^/(.*)$ /public/index.php?q=$1 last;}
    }

    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        fastcgi_param APPLICATION_ENV develop;
        fastcgi_param SECRET_KEY mysecretkey;
        fastcgi_pass   127.0.0.1:9000;
    }

    location / {
        if (!-e $request_filename) {rewrite ^/(.*)$ /frontend/index.html?q=$1 last;}
    }
}

server {
    listen 80 ;
    server_name     docs.hostname;
    error_log       /path/to/nginx/logs/hostname.error.log;
    access_log      /path/to/nginx/logs/hostname.access.log;
    index           index.html;
    root            /path/to/projects/hostname/docs;

    location / {
        try_files $uri $uri/ /index.html?$args;
    }

    location ~* (.+\.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar|woff|woff2|ttf|eot|svg))$ {
        try_files $uri =404;
    }
}
  1. migration
$ php partisan migrate --seed
  1. generate documentation (optional)
$ php partisan docsgenerate

About

This is my JSONAPI skeleton. Built using Slim 3, Eloquent, Zend-ACL


Languages

Language:PHP 53.1%Language:JavaScript 29.0%Language:HTML 12.6%Language:CSS 4.9%Language:Shell 0.3%