Thursday, February 3, 2022

How To Install and Use PHP Composer On Rocky Linux 8.5

 Composer is a dependency manager for PHP (as npm is to Node.js or pip is to Python).
Homepage - https://getcomposer.org/
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

dnf install php-cli php-json php-zip wget unzip -y
curl -sS https://getcomposer.org/installer | php ; mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer ; source ~/.bashrc ; composer -v

mkdir ~/first-composer-project
cd ~/first-composer-project
composer require nesbot/carbon
nano testing.php
<?php
require __DIR__ . '/vendor/autoload.php';
use Carbon\Carbon;
printf("Now: %s", Carbon::now());

php testing.php
composer update
_________________________________________________________________________________________


No comments:

Post a Comment