System Requirements

System Requirements

  • PHP >= 5.3.0

The mcrypt extension is required only if you use encrypted cookies.


Composer Install

Install composer in your project:

curl -s | php

Create a composer.json file in your project root:

    "require": {
        "slim/slim": "2.*"

Install via composer:

php composer.phar install

Add this line to your application’s index.php file:

require 'vendor/autoload.php';

Manual Install

Download and extract the Slim Framework into your project directory and require it in your application’s index.php file. You’ll also need to register Slim’s autoloader.

require 'Slim/Slim.php';

Hello World

Instantiate a Slim application:

$app = new \Slim\Slim();

Define an HTTP GET route:

$app->get('/hello/:name', function ($name) {
    echo "Hello, $name";

Run the Slim application: