awurth / slim-rest-base
This package is abandoned and no longer maintained.
No replacement package was suggested.
Slim PHP Micro-Framework for building a REST API
3.3.0
2019-01-06 14:33 UTC
Requires
- php: ^7.0
- awurth/slim-helpers: ^1.0
- awurth/slim-validation: ^3.0
- bshaffer/oauth2-server-php: ^1.9
- cartalyst/sentinel: ^2.0
- chadicus/slim-oauth2-http: ^3.1
- firebase/php-jwt: ^5.0
- illuminate/database: ^5.4
- illuminate/events: ^5.4
- monolog/monolog: ^1.23
- respect/validation: ^1.1
- slim/slim: ^3.8
- symfony/console: ^3.3
- symfony/dotenv: ^3.0
- symfony/http-foundation: ^3.3
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.6.1
- phpunit/phpunit: ^4.8|^5.0|^6.0
README
This is an app skeleton for the Slim PHP Micro-Framework to get started quickly building a REST API
Features
- Eloquent ORM
- Authentication (Sentinel + OAuth 2)
- Validation (Respect + Slim Validation)
- Logs (Monolog)
- Dotenv configuration
- Console commands for updating the database schema and creating users
- A RESTful router
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
- Create a new database.
- Rename /env.dist to .env and set the db connection details.
- 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