- https://getcomposer.org/doc/00-intro.md#downloading-the-composer-executable
- the Download page instructions
$ php -version
PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
$ which php
/usr/bin/php
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G65
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 10.13.6 (17G65)
Kernel Version: Darwin 17.7.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: MacBook Pro di Franco
User Name: Franco Rondini (ronda)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 28 days 4:49
mkdircd api
mv ~/Downloads/installer.dms .
cat installer.dms # optional step
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
cat composer-setup.php # optional step
php -r "if (hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar --version
php composer.phar require slim/slim "^3.0"
I need to install Slim for a brand new api
project; the installation I choose is with minimal impact to the system i.e.=> "local"
Last login: Mon Oct 8 21:41:18 on ttys007
$ mkdircd api
$ mv ~/Downloads/installer.dms
$ cat installer.dms
full output of cat installer.dms
not here
Composer Installer
------------------
Options
--help this help
--check for checking environment only
--force forces the installation
--ansi force ANSI color output
--no-ansi disable ANSI color output
--quiet do not output unimportant messages
--install-dir="..." accepts a target installation directory
--preview install the latest version from the preview (alpha/beta/rc) channel instead of stable
--snapshot install the latest version from the snapshot (dev builds) channel instead of stable
--version="..." accepts a specific version to install instead of the latest
--filename="..." accepts a target filename (default: composer.phar)
--disable-tls disable SSL/TLS security for file downloads
--cafile="..." accepts a path to a Certificate Authority (CA) certificate file for SSL/TLS verification
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ ls -lrt
total 1040
-rw-r--r--@ 1 ronda staff 263621 Oct 13 05:33 installer.dms
-rw-r--r-- 1 ronda staff 263621 Oct 13 05:37 composer-setup.php
$ > cat composer-setup.php
output of cat composer-setup.php
not here
$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
$ php composer-setup.php
All settings correct for using Composer
Downloading...
Composer (version 1.7.2) successfully installed to: /Users/ronda/projects/sse/api/composer.phar
Use it: php composer.phar
$ php -r "unlink('composer-setup.php');"
$ ls -lrt
total 4744
-rw-r--r--@ 1 ronda staff 263621 Oct 13 05:33 installer.dms
-rwxr-xr-x 1 ronda staff 1875611 Oct 13 05:37 composer.phar
api $ php composer.phar --version
Composer version 1.7.2 2018-08-16 16:57:12
api $ php composer.phar require slim/slim "^3.0"
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
- Installing psr/container (1.0.0): Downloading (100%)
- Installing container-interop/container-interop (1.2.0): Downloading (100%)
- Installing nikic/fast-route (v1.3.0): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing pimple/pimple (v3.2.3): Downloading (100%)
- Installing slim/slim (3.11.0): Downloading (100%)
Writing lock file
Generating autoload files
api $ ls -lrt
total 4776
-rw-r--r--@ 1 ronda staff 263621 Oct 13 05:33 installer.dms
-rwxr-xr-x 1 ronda staff 1875611 Oct 13 05:37 composer.phar
-rw-r--r-- 1 ronda staff 55 Oct 13 05:42 composer.json
-rw-r--r-- 1 ronda staff 10895 Oct 13 05:42 composer.lock
drwxr-xr-x 9 ronda staff 288 Oct 13 05:42 vendor
api $ filetree
|-vendor
|---composer
|---container-interop
|-----container-interop
|-------docs
|---------images
|-------src
|---------Interop
|-----------Container
|-------------Exception
|---nikic
|-----fast-route
|-------src
|---------DataGenerator
|---------Dispatcher
|---------RouteParser
|-------test
|---------Dispatcher
|---------HackTypechecker
|-----------fixtures
|---------RouteParser
|---pimple
|-----pimple
|-------ext
|---------pimple
|-----------tests
|-------src
|---------Pimple
|-----------Exception
|-----------Psr11
|-----------Tests
|-------------Fixtures
|-------------Psr11
|---psr
|-----container
|-------src
|-----http-message
|-------src
|---slim
|-----slim
|-------Slim
|---------Exception
|---------Handlers
|-----------Strategies
|---------Http
|---------Interfaces
|-----------Http
mv composer.phar /usr/local/bin/composer
Now run composer
in order to run Composer instead of php composer.phar
.