Thursday, November 20, 2025
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
32405 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6777 POSTS0 COMMENTS
Nicole Veronica
11925 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11995 POSTS0 COMMENTS
Shaida Kate Naidoo
6905 POSTS0 COMMENTS
Ted Musemwa
7162 POSTS0 COMMENTS
Thapelo Manthata
6861 POSTS0 COMMENTS
Umr Jansen
6846 POSTS0 COMMENTS