ansas/slim-skeleton

Slim 3 framework skeleton - skeleton for a web service or an application

Installs: 38

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 5

Forks: 0

Open Issues: 0

Type:application

1.0.1 2018-01-05 12:07 UTC

This package is auto-updated.

Last update: 2024-03-06 11:52:41 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Skeleton for a web service or an application (based on Slim 3 framework).

This skeleton follows several PHP Standards Recommendations (PSR):

  • PSR-1 / PSR-2 (Coding standards)
  • PSR-3 (Logging) via Monolog
  • PSR-4 (Autoloading) via Composer
  • PSR-7 (HTTP message) via Slim

Included components

  • Slim 3.x incl. Flash messages & Twig view (MIT License)
  • Twig template engine 1.x (BSD License)
  • Monolog logger 1.x (MIT License)
  • Custom Error and NotFound handler
  • Middlewares: Cors, ForceRoute, Runtime, NoTrailingSlash, etc.
  • Provider: ConsoleLoggerProvider, ExtendedRequestProvider, PdoProvider, ProfilerProvider, etc.
  • Tests: PHPUnit bootstrap and AppTestCase prepared

Directory structure

path/to/project
|-- app                 <- Application config files
|   |-- slim            <- Slim config files
|   `-- twig            <- Twig templates
|-- bin                 <- Own scripts
|-- etc                 <- Own config files (like Apache)
|-- lib                 <- Vendor files (for composer)
|-- log                 <- Log files
|-- pub                 <- Webserver document root
|   |-- css
|   |-- img
|   |-- js
|   `-- lib
|-- src                 <- Application classes
|   `-- App
|       |-- Controller
|       |-- Handler     <- Put custom handlers here
|       |-- Middleware  <- Put custom middlewares here
|       |-- Model
|       |-- Provider    <- Put custom providers here
|       `-- Tests       <- Put custom tests (unit and integration tests) here
`-- tmp                 <- Temporary files
|   |-- session
|   `-- twig
`-- var                 <- Put other data in here

Requirements

Usage

Install / Create project

$ composer create-project ansas/slim-skeleton path/to/project

Develop / Run PHP build-in server

$ cd path/to/project
$ composer server

Open web browser with address http://any-domain-pointing-to-server:8888

Call controller from console

$ cd path/to/project
$ composer run The\Controller\YouWantToRun <- calls __invoke()
$ composer run The\Controller\YouWantToRun:methodWanted
$ composer run The\Controller\YouWantToRun:methodWanted parem1=yes param2=hi

Test / Check coding style and test code

$ cd path/to/project
$ composer test

Contribute

Everybody can contribute to this package. Just:

  1. fork it,
  2. make your changes and
  3. send a pull request.

Please make sure to follow PSR-1 and PSR-2 coding conventions.

License

MIT license (see the LICENSE file for more information).