All Projects → rrpadilla → slim3-api-skeleton

rrpadilla / slim3-api-skeleton

Licence: MIT license
Slim 3 API Skeleton with content negotiation, authentication, error handling, cache and performance in mind.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to slim3-api-skeleton

Slim4 Skeleton
A Slim 4 Skeleton
Stars: ✭ 237 (+1875%)
Mutual labels:  slim
GraphQLSuiteCRM
GraphQL SuiteCRM - Integrate with SuiteCRM using GraphQL
Stars: ✭ 18 (+50%)
Mutual labels:  slim
slim-tutorial
Php Slim Framework Tutorial
Stars: ✭ 26 (+116.67%)
Mutual labels:  slim
basepath
Base path detector for Slim 4
Stars: ✭ 36 (+200%)
Mutual labels:  slim
charcoal-app
Slim-based application (modules, routes / controllers and middlewares)
Stars: ✭ 13 (+8.33%)
Mutual labels:  slim
RecSys Course 2017
DEPRECATED This is the official repository for the 2017 Recommender Systems course at Polimi.
Stars: ✭ 23 (+91.67%)
Mutual labels:  slim
Slim Born
Slim Framework 3 and 4 skeleton application has authentication MVC construction.
Stars: ✭ 179 (+1391.67%)
Mutual labels:  slim
Express-REST-API-Generator
Express REST API Generator is an Express Based API skeleton. A template for starting projects with express as an API. This project can be used for creating a RESTful API using Node JS, Express as the framework, Mongoose to interact with a MongoDB instance and Sequelize for support of SQL compatible databases. Mocha is also used for running unit …
Stars: ✭ 100 (+733.33%)
Mutual labels:  api-skeleton
rawphp
A powerful, robust and API-first, PHP framework that helps people from different PHP backgrounds work on the same project seamlessly. You can write Laravel, CakePHP, Slim, Symphone and Procedural PHP code inside it and it all works perfectly. Its the PHP Framework for everyone.
Stars: ✭ 31 (+158.33%)
Mutual labels:  slim
api rest slim framework
RESTFUL API o API REST con slim framework (PHP, MySql, PDO)
Stars: ✭ 14 (+16.67%)
Mutual labels:  slim
middleman-snippets
⚡ Library of commonly used snippets for Middleman websites
Stars: ✭ 27 (+125%)
Mutual labels:  slim
slim-boilerplate
A PHP boilerplate,for a fast API prototyping based on Slim Framework, for start projects with Eloquent ORM, Validation, Auth (JWT), Repositories and Transformers ready
Stars: ✭ 58 (+383.33%)
Mutual labels:  slim
DenseNet-Tensorflow
Reimplementation of DenseNet
Stars: ✭ 16 (+33.33%)
Mutual labels:  slim
Fengniao
A command line tool for cleaning unused resources in Xcode.
Stars: ✭ 2,852 (+23666.67%)
Mutual labels:  slim
negotiation
PSR-15 middleware to implement content negotiation
Stars: ✭ 42 (+250%)
Mutual labels:  content-negotiation
Ruby2 Rails4 Bootstrap Heroku
A starter application based on Ruby 2.4, Rails 4.2 and Bootstrap for Sass 3, deployable on Heroku
Stars: ✭ 181 (+1408.33%)
Mutual labels:  slim
SLiM
SLiM is a genetically explicit forward simulation software package for population genetics and evolutionary biology. It is highly flexible, with a built-in scripting language, and has a cross-platform graphical modeling environment called SLiMgui.
Stars: ✭ 102 (+750%)
Mutual labels:  slim
dotfiles
my rice dump featuring meme bash aliases, minimal slim theme with waifus, some new i3 modes and a transparent status bar with blocks scripts.
Stars: ✭ 23 (+91.67%)
Mutual labels:  slim
PHP-Frameworks-Bench
Popular PHP Frameworks Benchmark.
Stars: ✭ 28 (+133.33%)
Mutual labels:  slim
Slim-Auth
A Slim 4 Skeleton.
Stars: ✭ 22 (+83.33%)
Mutual labels:  slim

Slim 3 API Skeleton

This is an API skeleton using Slim 3 with content negotiation, authentication, error handling, cache and performance in mind. Error and exception handling is already configured for you. Check config/dependencies.php file.

Content Negotiation

Content Negotiation is handled using a query parameter and the HTTP Header "Accept".

  • The default query parameter is "output" and possible values are ("json" or "xml").
  • If "output" parameter is not provided the HTTP Header "Accept" is used to determine which "Content type". If is not containing "application/json" or "application/xml" the default output will be "json".

This project use the following packages/components:

You can integrate any third-party components found on Packagist:

Run it:

  1. $ cd my-app
  2. $ php -S 0.0.0.0:8888 -t public public/index.php
  3. Browse to http://localhost:8888

Key directories

  • app/: directory contains the core code of your application. All class files within the App namespace.
  • app/Controllers/: directory contains controllers and actions classes.
  • app/Handlers/: directory contains handlers classes (Error, PhpError, NotFound, NotAllowed).
  • app/Helpers/: directory contains helpers classes.
  • app/Middleware/: directory contains middleware classes.
  • app/Renders/: directory contains renders classes for specific responses (json and xml).
  • bootstrap/: directory contains files that bootstrap the framework and configure autoloading.
  • cache/: directory contains framework generated files for performance optimization such as the route file. Should be writable by your web server.
  • cache/routes/: directory is used to store routes generated files. For better performance on production. Should be writable by your web server.
  • config/: directory contains all of your application's configuration files (settings, dependencies, middleware).
  • logs/: directory contains your application's log files. Should be writable by your web server.
  • public/: directory contains the index.php file, which is the entry point for all requests entering your application.
  • routes/: directory contains all of the route definitions for your application. By default, 1 route file is included: routes.php.
  • tests/: directory contains your automated tests. An example PHPUnit is provided out of the box. To run tests: phpunit -- verbose tests/DefaultRoutesTest.php.
  • vendor/: directory contains your Composer dependencies.

Key files

  • public/index.php: entry point to application.
  • bootstrap/app.php: bootstrap the framework, configure auto-loading, dependencies, routes, etc.
  • env.php.dist: environment settings. Must copy it to env.php and modify that one.
  • config/dependencies.php: services for Pimple. Including (Database, Exception/Error handlers, Logger, etc).
  • config/middleware.php: application middleware.
  • config/settings.php: slim and others configurations. Rewrite Slim default settings (displayErrorDetails, routerCacheFile).
  • routes/routes.php: all application routes are here.
  • app/Controllers/ExampleAction.php: example Action class.
  • app/Helpers/ArrayToXml.php: Helper class to convert array to xml. Used by XmlApiView class.
  • app/Renders/ApiView.php: Render output based on a PSR-7 Request's Accept header.
  • app/Renders/JsonApiView.php: view wrapper for json responses (with error code). Return "meta" and "data". "meta" contains "error" (true/false) and "status" (HTTP Status code).
  • app/Renders/XmlApiView.php: view wrapper for xml responses (with error code). Return "meta" and "data". "meta" contains "error" (true/false) and "status" (HTTP Status code).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].