Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.

<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require 'vendor/autoload.php';

$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
    $name = $request->getAttribute('name');
    $response->getBody()->write("Hello, $name");

    return $response;
});
$app->run();
Swag! We have some. Shop Now

Download & Install

We recommend you install the Slim Framework with the Composer dependency manager.

The easiest way to start working with Slim is to create a project using Slim-Skeleton as a base by running this bash command:

$ php composer.phar create-project slim/slim-skeleton [my-app-name]

Replace [my-app-name] with the desired directory name for your new application.

You can then run it with PHP's built-in webserver:

$ cd [my-app-name]; php -S 0.0.0.0:8080 -t public public/index.php

Features

HTTP Router

Slim provides a fast and powerful router that maps route callbacks to specific HTTP request methods and URIs. It supports parameters and pattern matching.

Middleware

Build your application with concentric middleware to tweak the HTTP request and response objects around your Slim app.

PSR-7 Support

Slim supports any PSR-7 HTTP message implementation so you may inspect and manipulate HTTP message method, status, URI, headers, cookies, and body.

Dependency Injection

Slim supports dependency injection so you have complete control of your external tools. Use any Container-Interop container.

Latest News

Slim 3.5.0 released

A few useful bug fixes in this release including the ability to read the ‘Authorization’ header without tweaking .htaccess files or manually looking in getallheaders()!

Slim 3.4.2 released

3.4.1 had a BC break when handling errors where the acceptable media type listed in the Accept header wasn’t the first one. This is now fixed.

Slim 3.4.1 released

This releases fixes a infinite loop bug discovered in version 3.4.0 and also adds additional unit tests.

Older News

Subscribe with RSS

Newsletter

Don't have Twitter? Join our newsletter and receive one email a week (at most) with the latest Slim Framework news, release announcements, and security updates. We hate spam, and we'll respect your inbox. You can unsubscribe at any time.

Email Archives

Chat on IRC

The official Freenode IRC channel is #slimphp. You can chat with other Slim Framework developers to share code or troubleshoot tricky issues. My nick is codeguy if you have questions or need assistance in the IRC channel.

Visit the IRC Channel

Read real-time IRC logs on BotBot.me

Follow @slimphp on Twitter