How to install Slim Framework on Debian 10?

0
46

Web development in Debian 10 is quite common. This is due to the robustness of the operating system. Therefore, many developers who seek in this system the tranquility of developing their projects without surprises is what makes it a solid alternative. In this sense, PHP is presented to us as the most popular language for the development of web applications. There are many powerful and versatile frameworks to start developing. In this post, I will talk to you about how to install Slim Framework on Debian 10.

Slim a PHP microframework

You have probably heard about the most popular PHP frameworks like Cake or Laravel. Just to quote those two, because there are even better ones. However, in this opportunity, we have a small one that will allow us to develop applications quickly and easily. This is the case of Slim.

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

Slim provides a fast and powerful router that maps route callbacks to specific HTTP request methods and URIs. As an important aspect, Slim supports any PSR-7 HTTP message implementation so you may inspect and manipulate HTTP message method, status, URI, headers, cookies, and body.

All this in a framework quite light and quick to use. So, let us install it on Debian 10.

Install Slim framework on Debian 10

Obviously the first step is to have PHP installed. To do this, just use this specific command to install it and also several of its modules:

:~$ sudo apt install php php-mbstring php-xml php-zip php-cli php-intl
1.- Install PHP on Debian 10
1.- Install PHP on Debian 10

The most recommended way to install Slim Framework is using Composer. As you know composer is a PHP dependency manager that is quite light and fulfills its purpose.

To install it in any Linux distribution we have a post.

Read, How to install Composer on Linux?

Then, we can start the installation.

To start the development with Slim quickly, it is recommended to use the slim-skeleton base that provides all the initial configurations made to save time. So to create the project use the following command:

:~$ composer create-project slim/slim-skeleton [app-name]

Of course, replace [app-name] with the name of your project. Then, it will start all dependency downloads.

2.- Install Slim framework on Debian 10
2.- Install Slim framework on Debian 10

When you’re done you’re ready to start. Of course, if you guide to see the application running, enter the project folder:

:~$ cd [app-name]
:~$ php -S localhost:8080 -t public public/index.php

Remember that you can change localhost for the host IP address and 8080 for another chosen port. If you are going to use this port, remember that it must be available in the firewall.

Then, go to your web browser and you’ll see something like this:

3.- Slim framework working on Debian 10
3.- Slim framework working on Debian 10

And ready, let’s keep working.

Conclusion

Slim is a lightweight framework for making web applications and APIs with PHP. Everything is fast and easy. Therefore, it is a very important alternative for our professional environment. Especially if we work with programming.

Please share this post and join our Telegram channel.

Read More

If You Appreciate What We Do Here On OsRadar, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Telegram
  2. Subscribe to our email updates: Sign Up Now
  3. Become a Supporter - Make a contribution via PayPal

We are thankful for your support.

LEAVE A REPLY

Please enter your comment!
Please enter your name here