Thursday, January 22, 2026
HomeLanguagesSlim Framework | Installation and Configuration

Slim Framework | Installation and Configuration

Slim is a lightweight, easy to use and fast PHP framework used to develop the powerful website quickly with ease. Like other PHP frameworks, slim also supports routers, middlewares, bodyparser, page templates, encrypted cookies and much more. Prerequisites:

  1. PHP installation on windows
  2. Environment Setup To Run the Project
  3. Composer Software to install slim

Installation:

  1. Go to your directory where XAMPP is installed and open htdocs folder. (In my case it is C:\xampp\htdocs).
  2. Open command prompt and navigate to current working directory as your current directory.
  3. Enter the command
mkdir project_name && cd project_name
  1. This command will create a project folder with project_name and set the present working directory to it.
  2. Now enter the command
composer require slim/slim:3.* 
  1. (Here 3.* refers to version number) This will install the slim framework in the current directory.
  2. Now enter the command
notepad index.php
  1. and click on yes. It will create a new file index.php and will open it for editing.
  2. Now type the following code in the file 

CPP




<?php
 
require 'vendor/autoload.php';
 
$app = new \Slim\App;
$app->get('/', function () {
  echo 'Welcome to my slim app';
});
$app->run();
?>


  1. It is the code for our first slim application.
  2. Save the file and close it.
  3. Open xampp control panel and run the apache server.
  4. Now open a web browser and go to url -> http://localhost:81/project_name/ As you can see our first app is running on the server successfully. You have successfully installed slim and have created your first app with that.
RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS