2017 © Pedro Peláez
 

library slim-rest-base

Slim PHP Micro-Framework for building a REST API

image

awurth/slim-rest-base

Slim PHP Micro-Framework for building a REST API

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 27 Versions
  • 11 % Grown

The README.md

Slim 3 RESTful application skeleton

SensioLabsInsight Scrutinizer Code Quality, (*1)

This is an app skeleton for the Slim PHP Micro-Framework to get started quickly building a REST API, (*2)

Features

Installation

Create Project

``` bash $ composer create-project awurth/slim-rest-base [app-name], (*3)


##### Set File permissions ``` bash cd [app-name] sudo chown -R [your-username]:www-data [app-name] sudo chmod -R 775 [app-name]/var
Create database
  1. Create a new database.
  2. Rename /env.dist to .env and set the db connection details.
  3. Create Tables ``` bash $ php bin/console db

##### Set URL (dev) Used for generating links in API routes markdown. ``` bash $ sudo nano /config/services.dev.php

Edit line 6 and set the url to your API. ``` php $config['rest']['url'] = 'https://[your-url]';, (*4)


## Console Tools ### Create users ``` bash $ php bin/console user:create

Use --admin option to set the user as admin, (*5)

Dump routes

Execute the following command at the project root to print all routes in your terminal ``` bash $ php bin/console routes, (*6)


Use --markdown or -m option to display routes in markdown format ``` bash $ php bin/console routes -m > API.md

If you're using Oh My Zsh, you can install the symfony2 plugin, which provides an alias and autocompletion: ``` bash, (*7)

Without Symfony2 plugin

$ php bin/console db, (*8)

With Symfony2 plugin

$ sf db ```, (*9)

TODO

  • PHPUnit

The Versions