Need help with Slim?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

11.1K Stars 1.9K Forks MIT License 4.2K Commits 9 Opened issues


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

Services available


Need anything else?

Contributors list

Slim Framework

Build Status Coverage Status Total Downloads License

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


It's recommended that you use Composer to install Slim.

$ composer require slim/slim

This will install Slim and all required dependencies. Slim requires PHP 7.3 or newer.

Choose a PSR-7 Implementation & ServerRequest Creator

Before you can get up and running with Slim you will need to choose a PSR-7 implementation that best fits your application. A few notable ones: - Slim-Psr7 - This is the Slim Framework PSR-7 implementation - Nyholm/psr7 & Nyholm/psr7-server - This is the fastest, strictest and most lightweight implementation available - Guzzle/psr7 - This is the implementation used by the Guzzle Client, featuring extra functionality for stream and file handling - laminas-diactoros - This is the Laminas (Zend) PSR-7 implementation

Slim-Http Decorators

Slim-Http is a set of decorators for any PSR-7 implementation that we recommend is used with Slim Framework. To install the Slim-Http library simply run the following command:

composer require slim/http


object decorators are automatically detected and applied by the internal factories. If you have installed Slim-Http and wish to turn off automatic object decoration then you can use the following statements: ```php <?php

use Slim\Factory\AppFactory; use Slim\Factory\ServerRequestCreatorFactory;

AppFactory::setSlimHttpDecoratorsAutomaticDetection(false); ServerRequestCreatorFactory::setSlimHttpDecoratorsAutomaticDetection(false);

$app = AppFactory::create();

// ... ```

Hello World using AppFactory with PSR-7 auto-detection

In order for auto-detection to work and enable you to use

without having to manually create a
you need to install one of the following implementations: - Slim-Psr7 - Install using
composer require slim/psr7
- Nyholm/psr7 & Nyholm/psr7-server - Install using
composer require nyholm/psr7 nyholm/psr7-server
- Guzzle/psr7 - Install using
composer require guzzlehttp/psr7
- laminas-diactoros - Install using
composer require laminas/laminas-diactoros

Then create file public/index.php.

require DIR . '/../vendor/autoload.php';

// Instantiate App $app = AppFactory::create();

// Add error middleware $app->addErrorMiddleware(true, true, true);

// Add routes $app->get('/', function (Request $request, Response $response) { $response->getBody()->write('Try /hello/world'); return $response; });

$app->get('/hello/{name}', function (Request $request, Response $response, $args) { $name = $args['name']; $response->getBody()->write("Hello, $name"); return $response; });


You may quickly test this using the built-in PHP server:

$ php -S localhost:8000 -t public

Going to http://localhost:8000/hello/world will now display "Hello, world".

For more information on how to configure your web server, see the Documentation.


To execute the test suite, you'll need to install all development dependencies.

$ git clone
$ composer install
$ composer test


Please see CONTRIBUTING for details.

Learn More

Learn more at these links:


If you discover security related issues, please email [email protected] instead of using the issue tracker.

For enterprise

Available as part of the Tidelift Subscription.

The maintainers of

and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.


Code Contributors

This project exists thanks to all the people who contribute. Contribute.

Financial Contributors

Become a financial contributor and help us sustain our community. Contribute



Support this project with your organization. Your logo will show up here with a link to your website. Contribute


The Slim Framework is licensed under the MIT license. See License File for more information.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.