Thursday, September 4, 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
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS