Difference between revisions of "Composer and NPM"
Line 16: | Line 16: | ||
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. | ||
See: https://getcomposer.org/doc/00-intro.md/ | See: https://getcomposer.org/doc/00-intro.md/ | ||
To test your installation, open up your favourite Command Line Interface (CLI) and run: | |||
<pre>composer</pre> | |||
And you should get output similar to this: | |||
<pre> ______ | |||
/ ____/___ ____ ___ ____ ____ ________ _____ | |||
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ | |||
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / | |||
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ | |||
/_/ | |||
Composer version 1.1.2 2016-05-31 19:48:11 | |||
Usage: | |||
command [options] [arguments] | |||
Options: | |||
-h, --help Display this help message | |||
-q, --quiet Do not output any message | |||
-V, --version Display this application version | |||
--ansi Force ANSI output | |||
--no-ansi Disable ANSI output | |||
-n, --no-interaction Do not ask any interactive question | |||
--profile Display timing and memory usage information | |||
--no-plugins Whether to disable plugins. | |||
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. | |||
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</pre> | |||
==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: | ||
Line 28: | Line 56: | ||
Now, relaunch your terminal and you'll be able to access Composer simply by calling <code>composer</code><br> | Now, relaunch your terminal and you'll be able to access Composer simply by calling <code>composer</code><br> | ||
See: https://www.abeautifulsite.net/installing-composer-on-os-x | See: https://www.abeautifulsite.net/installing-composer-on-os-x | ||
To test your installation, open up your favourite Command Line Interface (CLI) and run: | |||
<pre>composer</pre> | |||
And you should get output similar to this: | |||
<pre> ______ | |||
/ ____/___ ____ ___ ____ ____ ________ _____ | |||
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ | |||
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / | |||
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ | |||
/_/ | |||
Composer version 1.1.2 2016-05-31 19:48:11 | |||
Usage: | |||
command [options] [arguments] | |||
Options: | |||
-h, --help Display this help message | |||
-q, --quiet Do not output any message | |||
-V, --version Display this application version | |||
--ansi Force ANSI output | |||
--no-ansi Disable ANSI output | |||
-n, --no-interaction Do not ask any interactive question | |||
--profile Display timing and memory usage information | |||
--no-plugins Whether to disable plugins. | |||
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. | |||
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</pre> | |||
=Usage= | =Usage= |
Revision as of 22:57, 13 July 2016
Overview
Introduction
Composer is a command line 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.
End Goal
- Centralize and organize all PHP libraries/dependancies into a single directory.
- Use Composer to collect and organize the PHP libraries/dependancies.
- Migrate all the PHP libraries/dependancies.
- Setup composer to use PSR-4 autoloading.
- Centralize and organize all PHP libraries/dependancies into a single directory.
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.
See: https://getcomposer.org/doc/00-intro.md/
To test your installation, open up your favourite Command Line Interface (CLI) and run:
composer
And you should get output similar to this:
______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 1.1.2 2016-05-31 19:48:11 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
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
See: https://www.abeautifulsite.net/installing-composer-on-os-x
To test your installation, open up your favourite Command Line Interface (CLI) and run:
composer
And you should get output similar to this:
______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 1.1.2 2016-05-31 19:48:11 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Usage
- clone the OpenEMR development version from github: https://github.com/openemr/openemr.git
git clone https://github.com/openemr/openemr.git
- Then run composer inside the folder of your OpenEMR installation to get all third party dependencies/libraries:
cd openemr composer install