Have you ever felt complicated with existing libraries in PHP? For example, you want to use the DOMpdf library, Faker, Carbon and so on. Of course, you have to download it first and then install one by one. Quite complicated and tiring, right? You can imagine when you need a lot of libraries for website needs. How much time is wasted on downloading and installing. Not to mention if the dependency crashes then the website error. Relax, developers! Now there are tools that can help with PHP library management, you know. The tool is called Composer. What is Composer? How do I install composer on Hosting ? Let's check it out! 😀

Also Read: How to Upload Website Files to Hosting

What is Composer?

Composer is a tool for PHP dependency management. According to Wikipedia , Composer is a dependency package for the PHP programming language that functions to manage PHP dependencies and libraries. Composer was developed in 2011 by Nils Adermann and Jordi Boggiano. Now with this composer, developers don't need to download libraries and dependencies one by one. Just write in the library what you want in composer. Then by itself, Composer will find what libraries are compatible with the PHP version and install them automatically.

How to Install Composer on Hosting

You can also install Composer on Hosting. The method is almost the same when you install Composer on Linux. As for the method, namely,

1. Access Hosting via SSH

To install Composer on Hosting, you must go to the Hosting server via SSH. For those who don't know how, please read the SSH Access Guide via Linux Terminals and Putty . After successful hosting access, please login according to your cPanel username and password.

Also Read: What is SSH

Remember, SSH access can only be done at a minimum of the Super Hosting Package !

2. Go to Folder / tmp

The second step is to enter the / tmp directory. As for the method, namely,

3. Installing Composer on Hosting

Then, install composer on Hosting. The first time you have to download the composer file using the curl command like this,

 

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

4. Move File Composer to Folder / bin

After the composer file has been downloaded, you can move the composer.phar file to the / bin folder. This works so that you can call the composer command directly via the console / terminal. How to move it, namely,

 

mkdir ~/bin

mv composer.phar ~/bin/composer

chmod +x ~/bin/composer

echo "export PATH=$HOME/bin:$PATH" >> ~/.bash_profile

source ~/.bash_profile

The chmod + x command is used to grant / privileged access to the / bin / composer folder.

5. Composer Installation Successful!

So now Composer has been successfully installed on Hosting. Try checking your composer in the following way,

then it will appear as shown below,

Now try to check the composer version in the following way. Then the composer version will appear!

How to Use Composer?

The installation was successful, then how do I use composer? For PHP developers, of course, you already know how to use composer. So, for those who are trying composer for the first time, you can read how to use the following composer. Composer is a tool for dependency management and PHP libraries. To find out the various libraries, dependencies or frameworks that can be installed via composer, check https://packagist.org/ . In the search field, please write the desired library. For example, let's say we want to include twbs / bootstrap this time.


Click the library that you want. Try to scroll to the bottom there are several ways to do the installation. In this example, all you have to do is write the following command,

 

composer require twbs/bootstrap:4.0.0

Then the desired library will be automatically downloaded. Now check the composer.json file. The library has appeared, right? That's a sign, you are ready to use the library in the website file that you are developing.

Conclusion

From now on, you can install any PHP libraries, dependencies or framework through composer. Apart from being easier and faster, there are many options that you can use. Interested in using KincaiHosting Hosting? Come check KincaiHosting Cheap Hosting ! You can get lots of promos and discounts. Greetings, KincaiHosting! 😀

Also read: Should my website have SSL installed

What is Safelink Asia?

Safelink.asia is a completely free tool where you can create short links. URL security with cryptographic algorithm. Protect your web visitors with a secure link, to avoid viruses, malware, thief, etc. Apart from being free, you get paid! Register now!


Shorten URLs & earn money

So, now you can make money from home, when managing and protecting your links with Safelink Asia. Signup for an account in just 1 minutes. Once you've completed your registration just start creating short URLs and sharing the links with your family and friends. See our proof of payment and publisher rate.


Our partners and network

Here are some of our partners and networks that have collaborated on advertising: 401XD Group, MC Project, Kincai Media, Kartu Nama Digital, SEO Secret Indonesia, Safelink Asia, Media Bisnis, Blackexpo, Adigunawan.net.