Skip to content

Latest commit

 

History

History
93 lines (60 loc) · 3.54 KB

guide.en-ie.md

File metadata and controls

93 lines (60 loc) · 3.54 KB
title slug excerpt section order updated
Installing Composer on a Web Hosting plan
install_composer_on_web_hosting_packages
Find out how to install and take your first steps with Composer
PHP
2
2023-03-07

Last updated 7th March 2023

Objective

Composer{.external} is a dependency manager created for the PHP language. It allows PHP developers to include external libraries in their programs. Composer allows PHP projects to facilitate library distribution and code maintenance. Since the creation of this tool, many good development practices have been proposed and have improved the libraries of the PHP community. These good practices are documented in the form of SRP{.external}.

This guide explains how to install Composer and provides an example of usage with a Web Hosting plan.

Warning

OVHcloud provides services that you are responsible for with regard to their configuration and management. It is therefore your responsibility to ensure that they function properly.

This guide is designed to help you with common tasks. Nevertheless, we recommend contacting a specialist provider or reach out to the OVHcloud community if you encounter any difficulties. We will not be able to assist you. You can find more information in the Go further section of this guide.

Requirements

Instructions

Access your hosting plan via SSH using our guide to using SSH with your OVHcloud web hosting plan.

Use the command line to check if the PHP version is compatible:

php --version

If this is not a proper version, you can configure an alias:

alias php='/usr/local/php8.0/bin/php'

We recommend staying in the root folder of your Web Hosting in order to prevent your Composer files from being publicly accessible. Next, run this command:

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

Composer is now available on your Web Hosting.

Use cases

If you want to install Symfony 2, you can for example run the following command:

php composer.phar create-project symfony/framework-standard-edition my_project_name "2.7.*"

You can also use the OVHcloud API from your hosting using the official wrapper. To do this, add a file named composer.json containing the list of dependencies you need. Here is an example of this file with the OVHcloud API wrapper:

1. {
2.     "name": "Example Application",
3.     "description": "This is an example of OVHcloud APIs wrapper usage",
4.     "require": {
5.         "ovh/ovh": "1.1.*"
6.     }
7. }

To install it, run the following command in the same folder:

php composer.phar install

To use this library, please refer to the documentation, as well as the code, available on GitHub{.external}.

Go further

For specialised services (SEO, development, etc.), contact OVHcloud partners.

If you would like assistance using and configuring your OVHcloud solutions, please refer to our support offers.

Join our community of users on https://community.ovh.com/en/.