🐘
PHP & MySQL

Using PHP Composer for Your Hosting Project

πŸ“… 13 October 2026 ✏️ 13 October 2026 ⏱ 4 min leestijd

Learn how to install and use Composer for PHP projects, and how to apply it to your web hosting at Tandata.

Composer is the standard dependency manager for PHP: it automatically installs and manages the libraries your project needs. Instead of manually downloading individual PHP files, you describe in one file which packages you use, and Composer handles the rest, including versions and interdependencies. Below you’ll learn how to install, use, and deploy Composer on your web hosting.

What is Composer and why use it

Many PHP projects, from a simple website to a framework like Laravel or Symfony, are built from dozens of external libraries. Composer keeps track of which packages you use, in which version, and which other packages are required for them. Everything is recorded in two files: composer.json (what you want) and composer.lock (what is exactly installed). Thanks to that lock file, your project works on any server, including your production environment, with exactly the same versions as on your own computer.

composer.jsonComposer/vendor folder

Installing Composer

On your own computer, you can easily install Composer via the installer from the official website, available for Windows, macOS, and Linux. After installation, type composer --version in the terminal to check that it works. Many shared hosting environments, including Tandata’s web hosting, already have Composer available by default via SSH access, so you don’t need to install it yourself.

πŸ’‘ Tip: always use the same PHP version locally as on your server. Differences in PHP version can cause packages to work locally but not on the server.

Setting up a project with Composer

Once Composer is working, you can use it to start a new project or extend an existing project with additional functionality.

1

Create a project folder

Navigate to your project folder in the terminal and run composer init. You’ll be guided through a series of questions about project name, description, and license, after which a composer.json file is created.

2

Add a package

Install a library with, for example, composer require guzzlehttp/guzzle. Composer downloads the package and all required dependencies into the vendor folder.

3

Load the autoloader

Add require 'vendor/autoload.php'; at the top of your PHP file. From that point on, you can use all installed classes directly without separate include statements.

4

Update packages

Use composer update to update packages within the allowed version constraints, or composer install to install exactly the versions from composer.lock.

Using Composer on your hosting

On a production server, you usually run Composer via SSH. Log in to your hosting account, navigate to the project folder, and run composer install --no-dev --optimize-autoloader. The --no-dev option ensures that development packages, such as testing tools, are not included, and the optimized autoloader ensures faster load times. Make sure the vendor folder and your .env file are never publicly accessible: always keep sensitive files outside the folder that is directly accessible via the internet.

At Tandata, web hosting runs on LiteSpeed servers with NVMe storage, making Composer installations and the loading of PHP libraries noticeably faster. Through Plesk in your control panel, you can easily set the right PHP version per domain, which is important because some Composer packages require a minimum PHP version. Check out the possibilities of web hosting if you’re looking for an environment suitable for PHP projects with Composer. If you run into any issues, consult the knowledge base or contact 24/7 support.

Frequently Asked Questions

Is Composer the same as a package manager like npm?

The principle is similar: both manage dependencies for a project. Composer is specifically made for PHP, while npm is used for JavaScript packages.

Do I need to upload the vendor folder to my server?

You can, but it’s better to run Composer directly on the server via SSH. This prevents you from accidentally uploading incorrect or platform-specific files.

What should I do if composer install gives an error about the PHP version?

Check which PHP version the package requires and set the correct PHP version for your domain in Plesk. Then run the installation again.

Can I use Composer for a WordPress site?

Yes, more and more WordPress projects use Composer to manage themes, plugins, and PHP libraries, although WordPress also works fine without it by default.

Do I need SSH access to use Composer?

Not for local development, but to run Composer commands directly on your hosting environment, you usually need SSH access.

Conclusion

Composer makes managing PHP libraries straightforward and reliable, from local development to installation on your server. With the right PHP version, SSH access, and a fast server environment, using Composer runs smoothly and without surprises.

Check out web hosting β†’

Was dit artikel nuttig?