How to install composer via homebrew

I'm really new to MacOS so maybe this is simple question.

I'm using High Sierra with default PHP 7.1 installed, I've also installed PHP 7.2 running:

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.2

When I run:

brew install composer

I'm getting:

Error: No available formula with the name "composer" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

The question is how to install composer via homebrew? (Maybe I should somehow uninstall PHP I've installed and install PHP via homebrew?)


It's now possible to install composer running

brew install composer

Previous answer (for older versions):

It seems the solution was running:

brew tap homebrew/homebrew-php

and then

brew install composer

After that composer seems to be installed:

composer --version
Composer version 1.5.5 2017-12-01 14:42:57

Now as time passed, this works for me:

$ brew install composer