district5/slim-s4s

District5 Slim Framework 4 Stub

0.3.0 2024-10-24 16:04 UTC

This package is auto-updated.

Last update: 2024-10-24 16:04:29 UTC


README

This library provides Slim Framework 4 utilities for initialising and maintaining both Slim4 JSON based API's and lightweight UI based apps.

Usage

These instructions assume a standard app directory structure:

- app
| - api
| | - routes
| - www
| | - routes
- lib
| - ...
initialiser.php

Set Environment

Setting an environment, which can be accessed by routing apps:

\S4S\Slim4\Factory\AppFactory::setEnvironment(\S4S\Slim4\Enum\Environment::\S4S\Slim4\Enum\Development);

JSON API base App

$base = __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR;

$app = AppFactory::createJsonApi($base . 'api');
$app->run();

UI base App

$base = __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR;

$app = AppFactory::createUI($base . 'www');
$app->run();