Skip to content

Skinny — A PHP Application Framework

Skinny Origin

Features

  • Powerful, highly efficient, scalable router
    • Standard and custom HTTP methods
    • Route parameters, wildcards, and conditions
    • Route redirect, halt, and pass
    • Route middleware
  • Resource Locator and DI container
  • Template rendering with custom views
  • Flash messages
  • Encrypt cookie data
  • HTTP caching
  • Logging with custom log writers
  • Error handling and debugging
  • Middleware and hook architecture
  • Simple configuration
  • Conditional output buffering
  • Stream input support (e.g. AJAX PUT stream file upload)
  • Destruction of framework instances in unit tests

Table of Contents

Getting Started

System Requirements

You need PHP >= 5.4.0. (PHP >= 7.x is also fine.) If you use encrypted cookies you'll also need the openssl extension.

Install

The following example clones the Skinny repository from GitLab using command line git. You can allso download a .zip file and extract it into your project directory.

Let's create a directory for your project and call it play. Clone Skinny into a sub-directory named skinny. ('$>' represents your shell prompt)

$> mkdir play
$> cd play
$> git clone git@gitlab.com:ghaecker/Slim2Skinny.git skinny

Hello World

Assuming you successfully cloned Skinny into a directory called skinny, navigate to your installation directory. Create a document root and front-end controller.

$> cd skinny
$> mkdir public
$> touch public/index.php

With your favorite text editor, put the following content in public/index.php:

<?php

// 1. Set up autoloading
require_once './skinny/Skinny/Skinny.php';
\Skinny\Skinny::registerAutoloader();

// 2. Instantiate a Skinny application:
$app = \Skinny\Skinny::newInstance();

// 3. Define a HTTP GET route:
$app->get('/hello(/:name)', function ($name = 'World') {
    echo "Hello, $name";
});

// 4. Run the Skinny application:
$app->run();

Note: the demo app shows an alternative way to set up autoloading.

While still in the installation directory, run this command:

$> php -S 127.0.0.1:8000 -t ./public

Open a web browser and type 127.0.0.1:8000/hello in the address bar. Try 127.0.0.1:8000/hello/Sam, too. There ya go... easy as pie.

Beyond this simple test, the documentation provides Web Server Setup Tips.

Official Website

Documentation

https://slim2skinny.grhdev.com/docs/

Demo App

https://slim2skinny.grhdev.com/

Source Code Repository

https://gitlab.com/ghaecker/Slim2Skinny

Author

Glenn Haecker <ghaecker at gmail.com> transitioned Slim v2 to Skinny privately in May of 2016. At the time, Slim's source files were being tracked internally with Mercurial. He has enhanced and extended its functionality since then. He is also the current maintainer.

License

The Skinny framework is released under the MIT public license.

https://slim2skinny.grhdev.com/docs/license