whatisgithub

What is slim?

slimphp/slim — explained in plain English

Analysis updated 2026-06-24

12,258PHPAudience · developerComplexity · 2/5Setup · moderate

In one sentence

Slim is a lightweight PHP micro-framework that provides only the essentials for building web apps and APIs: routing, error handling, and HTTP responses.

Mindmap

mindmap
  root((slim))
    What it does
      URL routing
      Error handling
      HTTP responses
    Tech Stack
      PHP
      Composer
      PSR-7
    Use Cases
      REST APIs
      Web backends
      Lightweight apps
    Audience
      PHP developers
      API builders
    Setup
      Install via Composer
      Pick PSR-7 impl
      Optional Slim-Http
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a REST API in PHP with minimal boilerplate using Slim routes.

USE CASE 2

Add clean URL routing to a PHP project without adopting a full MVC framework.

USE CASE 3

Create a lightweight web application backend that handles HTTP requests and returns JSON.

What is it built with?

PHPComposerPSR-7

How does it compare?

slimphp/slimphacility/phabricatortypecho/typecho
Stars12,25812,30512,335
LanguagePHPPHPPHP
Setup difficultymoderatehardmoderate
Complexity2/54/53/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Composer and a separate PSR-7 implementation choice before the first request can run.

So what is it?

Slim is a small PHP framework for building web applications and APIs. PHP is a programming language commonly used to build websites, and a "framework" is a pre-built structure that handles common tasks so you do not have to write everything from scratch. Slim is described as a "micro" framework, meaning it provides only the essentials: routing (deciding what code runs when someone visits a URL), error handling, and a way to send back HTTP responses. Installing it requires a tool called Composer, which is the standard package manager for PHP projects. Once installed, you define routes in code by specifying a URL pattern and a function that runs when someone visits that URL. The included example shows how a few lines of PHP can respond to a request like "/hello/world" with the text "Hello, world." Before you can use Slim, you also need to pick a PSR-7 implementation. PSR-7 is a shared standard that defines how HTTP requests and responses should be represented as PHP objects. Slim itself is not tied to one specific implementation, so the README lists several options (including one from Slim's own team, plus others from third parties) and explains how to install each. This flexibility is a deliberate design choice, but it does mean there is one extra decision to make before you can run your first request. Slim also includes an optional add-on library called Slim-Http, which wraps whichever PSR-7 implementation you chose and adds extra convenience methods. This is described as recommended but not required. The project has a test suite, a community forum, a Slack channel, and a documentation website. Security issues have a dedicated email address rather than the public issue tracker. The README also mentions an enterprise support option via a third-party subscription service for organizations that need commercial backing.

Copy-paste prompts

Prompt 1
Using Slim PHP framework, write a route that accepts POST /api/users with a JSON body and returns a 201 JSON response.
Prompt 2
Show me how to add authentication middleware to a Slim 4 PHP application.
Prompt 3
Set up Slim with the Nyholm PSR-7 implementation and handle a GET request that reads a URL segment.
Prompt 4
Write a Slim PHP error handler that returns JSON error messages instead of HTML.

Frequently asked questions

What is slim?

Slim is a lightweight PHP micro-framework that provides only the essentials for building web apps and APIs: routing, error handling, and HTTP responses.

What language is slim written in?

Mainly PHP. The stack also includes PHP, Composer, PSR-7.

How hard is slim to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is slim for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.