How to Install PHP Composer on CentOS 8

[ad_1]

A composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Install and use PHP composer on centOS 8; Through this tutorial, we will learn how to install and use PHP composer on CentOS 8.

How to Install PHP Composer on CentOS 8

Just follow the following steps to install PHP composer on centOS 8:

  • Step 1 – Install the PHP CLI
  • Step 2 – Download Composer with curl
  • Step 3 – Move Composer file
  • Step 4 – Getting Started with Composer

Step 1 – Install the PHP CLI

First of all, open the command line or terminal and execute the following command into it to install PHP CLI on centOS 8:

sudo dnf install php-cli php-json php-zip curl unzip

Step 2 – Download Composer with curl

Once the PHP CLI installation is completed, then execute the following command on the command line or terminal to download composer with curl:

curl -sS https://getcomposer.org/installer |php

Step 3 – Move Composer file

Then move the composer file using the following command on centOS 8:

sudo mv composer.phar /usr/local/bin/composer

Step 4 – Getting Started with Composer

At this point, WE have successfully installed Composer on CentOS system. And now, we will learn how to use Composer in a PHP project.

Now, execute the following command on the command line or terminal to create PHP project using the composer command:

mkdir ~/my-first-composer-project
cd ~/my-first-composer-project

Once the PHP project creation is done, then execute the following command to initialize a new Composer project and install the carbon package:

composer require nesbot/carbon

Then create a file named testing.php and add the following code:

<?php

require __DIR__ . '/vendor/autoload.php';

use Carbon\Carbon;

printf("Now: %s", Carbon::now());

Finally, execute the following command n command line or terminal to test above created PHP project with the help of PHP composer:

php testing.php

The output should look something like this:

Now: 2022-08-10 22:12:26

Conclusion

Through this tutorial, we have learned how to install and use Composer on CentOS 8 machine. And also how to use Composer to create a basic PHP project.

[ad_2]

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00
نيك فى المساج abdulaporn.info فلم سكس لبناني
secretary xvideo pornborn.mobi animal and girl sex video
محجبة هايجة yubosp.com سحاق مايا خليفه
xnxxindean youporner.net xnxximages
nayanthara xvideo tubzolina.mobi pornstar list
صور سكس نياكه tinatube.net اكبربزاز
xxx indian sexy video orgyvids.info desi nude outdoor
افلام جنسيه مترجمه عربي pornclassic.info ام تتناك من صديق ابنها
www xnxx sex.com justerporn.mobi xxx2018
ولد ينيك امه مصري hqtube.org افلام سكس بث مباشر
x vidoi lamboborn.mobi indian xxx video com
اجمل نيك فى الطيز radarporn.com نيك اجنبى
passion hentai hentaicamz.com most popular hentai
youporn india indianbluetube.com spicyplumpers
xxx dilli big-porn-house.com sexi video in hindi