DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Build Quicker With Zipper: Building a Ping Pong Ranking App Using TypeScript Functions
  • Auto-Scaling a Spring Boot Native App With Nomad
  • Android Cloud Apps with Azure
  • Managing Application Dependencies in the Cloud: Strategies and Best Practices

Trending

  • How to Parse Large XML Files in PHP Without Running Out of Memory
  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 2
  • Compliance Automated Standard Solution (COMPASS), Part 11: Compliance as Code, the OSCAL MCP Server Way
  • Beyond Manual Annotation: Engineering Self-Correcting Pseudo-Labeling Pipelines
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Install PHP Composer via SSH for Dependencies Management of Your Cloud App

Install PHP Composer via SSH for Dependencies Management of Your Cloud App

In this post we take a look at how to install the popular PHP dependency management tool, Composer, via SSH to help with our cloud-based PHP applications.

By 
Tetiana Markova user avatar
Tetiana Markova
·
Nov. 17, 16 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
10.6K Views

Join the DZone community and get the full member experience.

Join For Free

php composer guide to consolidate and centralize the management of dependencies can be a real problem for complex cloud applications. that is why the right decision here is to use already-proven, on the market dependency management tools.

composer is one of the most popular dependency management solutions for php, inspired by node’s npm and ruby’s bundler . it smartly manages all the required libraries and packages for your application. running on a per-project basis, composer determines which versions of which packages your project depends on and installs them in a working directory. moreover, this tool provides automatic updates load , allowing to keep your packages actual.

follow the instructions below to install php composer via jelastic ssh gateway and perform its configuration, that will enable us to execute it from any working directory throughout a server.

1. in order to run the composer installation by means of jelastic ssh gateway , you need to:

  • generate an ssh keypair.
  • add your public ssh key to the dashboard.
  • access your account via ssh protocol.

once you’ve established ssh connection to your apache php or nginx php server ( apache 2.4 in our example), you can easily integrate composer into your project.

2. run the composer installer from inside your server working directory to download the appropriate composer.phar archive:

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


php composer

3. rename the composer.phar file to just “ composer ” and move it to the private bin directory with the below commands:

mkdir ~/bin mv ~/composer.phar ~/bin/composer

install php composer

4. now, let’s add composer to the server path variable in order to be able to further execute it from any server directory. in such a way, you won’t have to write out the full path (i.e. /var/www/bin/composer ) for calling this dependencies manager when necessary.

for that, run one of the following commands depending on used application server:

  • for apache php :
export path=$path:/var/www/bin echo 'export path=$path:/var/www/bin' >> ~/.bash_profile

php composer ssh

  • for nginx php :
export path=$path:/var/lib/nginx/bin echo 'export path=$path:/var/lib/nginx/bin' >> ~/.bash_profile

php composer path
that’s it! composer is added to your path variable now.

5. everything is already set up! you can run the following command in order to ensure that php composer works as intended:

composer about

php composer manager

great! start using composer on your apache or nginx server and easily control dependencies within your php projects.

if you face any issues while installing php composer via jelastic ssh gateway, feel free to appeal for our technical experts’ assistance at stackoverflow .

Composer (software) Dependency PHP Cloud app

Published at DZone with permission of Tetiana Markova. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Build Quicker With Zipper: Building a Ping Pong Ranking App Using TypeScript Functions
  • Auto-Scaling a Spring Boot Native App With Nomad
  • Android Cloud Apps with Azure
  • Managing Application Dependencies in the Cloud: Strategies and Best Practices

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook