Navigation Menu

Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

awurth/SlimREST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slim 3 RESTful application skeleton

SensioLabsInsight Scrutinizer Code Quality

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

Features

Installation

Create Project
$ composer create-project awurth/slim-rest-base [app-name]
Set File permissions
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
$ php bin/console db
Set URL (dev)

Used for generating links in API routes markdown.

$ sudo nano /config/services.dev.php

Edit line 6 and set the url to your API.

$config['rest']['url'] = 'https://[your-url]';

Console Tools

Create users

$ php bin/console user:create

Use --admin option to set the user as admin

Dump routes

Execute the following command at the project root to print all routes in your terminal

$ php bin/console routes

Use --markdown or -m option to display routes in markdown format

$ 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:

# Without Symfony2 plugin
$ php bin/console db

# With Symfony2 plugin
$ sf db

TODO

  • PHPUnit

About

An app skeleton for building a REST API with the Slim PHP Micro-Framework

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages