cyve / slim-platform
PHP micro framework for REST API based on Slim
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
This package is auto-updated.
Last update: 2024-04-13 18:23:19 UTC
README
PHP micro framework for REST API based on Slim and inspired by API Platform.
Installation
$ composer create-project cyve/slim-platform"
// config.php return [ 'title' => 'Slim Platform', 'parameters' => [], 'resources' => [ 'book' => [ 'table' => 'book', 'model' => [ 'title' => ['type' => 'string', 'required' => true], 'isbn' => ['type' => 'string'], 'description' => ['type' => 'string'], 'author' => ['type' => 'string'], 'publicationDate' => ['type' => 'datetime'] ], 'actions' => [ 'create' => ['method' => 'POST', 'uri' => '/books'], 'read' => ['method' => 'GET', 'uri' => '/books/{id}'], 'update' => ['method' => 'PUT', 'uri' => '/books/{id}'], 'delete' => ['method' => 'DELETE', 'uri' => '/books/{id}'], 'index' => ['method' => 'GET', 'uri' => '/books'] ] ] ] ];
// index.php require 'vendor/autoload.php'; if (is_readable('.env')) { $_ENV = $_ENV + parse_ini_file('.env'); } $config = include 'config.php'; $config['parameters'] += $_ENV; $app = new SlimPlatform\App($config); $app->run();