Difference between revisions of "Composer and NPM"

From OpenEMR Project Wiki
Line 3: Line 3:
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
=Installation=
=Installation=
==Windows==
==Windows==  
This is the easiest way to get Composer set up on your machine.
This is the easiest way to get Composer set up on your machine.
The installer will download composer for you and set up your PATH environment variable so you can simply call <code>composer</code> from any directory.
The installer will download composer for you and set up your PATH environment variable so you can simply call <code>composer</code> from any directory.
Download and run <googa>https://getcomposer.org/Composer-Setup.exe|Composer-Setup.exe</googa> - it will install the latest composer version whenever it is executed.
Download and run <googa>https://getcomposer.org/Composer-Setup.exe|Composer-Setup.exe</googa> - it will install the latest composer version whenever it is executed.[https://getcomposer.org/doc/00-intro.md]
==Linux & MacOS==
==Linux & MacOS==  
The first step is to download Composer, which will effectively create a Phar (PHP Archive) file called composer.phar. From your terminal, run the following command:
The first step is to download Composer, which will effectively create a Phar (PHP Archive) file called composer.phar. From your terminal, run the following command:
<pre>curl -sS https://getcomposer.org/installer | php</pre>
<pre>curl -sS https://getcomposer.org/installer | php</pre>
Line 18: Line 18:
<pre>alias composer="php /usr/local/bin/composer.phar"</pre>
<pre>alias composer="php /usr/local/bin/composer.phar"</pre>
Now, relaunch your terminal and you'll be able to access Composer simply by calling <code>composer</code>
Now, relaunch your terminal and you'll be able to access Composer simply by calling <code>composer</code>
[https://www.abeautifulsite.net/installing-composer-on-os-x]

Revision as of 23:12, 11 July 2016

Under Construction.

Introduction

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Installation

Windows

This is the easiest way to get Composer set up on your machine. The installer will download composer for you and set up your PATH environment variable so you can simply call composer from any directory. Download and run Composer-Setup.exe - it will install the latest composer version whenever it is executed.[1]

Linux & MacOS

The first step is to download Composer, which will effectively create a Phar (PHP Archive) file called composer.phar. From your terminal, run the following command:

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

The resulting file will be called composer.phar, a PHP Archive that can be executed directly via PHP. However, in our case, we want Composer to be accessible globally by simply typing composer. To do this, move it to /usr/bin/ and create an alias:

sudo mv composer.phar /usr/local/bin/
vim ~/.bash_profile

Add this to your .bash_profile. It may be empty or non-existent, so go ahead and create it:

alias composer="php /usr/local/bin/composer.phar"

Now, relaunch your terminal and you'll be able to access Composer simply by calling composer [2]