Forge Home


A module to install PHARS: composer.phar, phpunit.phar, etc.


8,909 latest version

3.1 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.1 (latest)
  • 0.2.0
  • 0.1.8
  • 0.1.7
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Aug 27th 2015
This version is compatible with:
  • Puppet 3.7.x

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'gajdaw-php_phars', '0.2.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gajdaw-php_phars
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gajdaw-php_phars --version 0.2.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



gajdaw/php_phars — version 0.2.1 Aug 27th 2015

php_phars Puppet Module

Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Reference
  6. Limitations
  7. Development
  8. Inspiration


This module php_phars aims to simplify the installation of PHAR applications, like composer, phpunit, php-cs-fixer, etc.

Module Description

In general:

  • the module downloads a file to an arbitrary directory
  • sets the owner
  • sets the rights

It can be seen as a sequence of three:

  • wget
  • chown
  • chmod


The module contains a build-in catalog of well-known PHARS, like composer, phpunit, php-cs-fixer. Thus, you don't have to care about their URLs.

You can install:

  • all PHARS from the catalog
  • only those PHARS from the catalog that you need
  • user defined PHARS

The catalog is an array named $catalog: defined in manifests/params.pp file. This array is shown in Reference.


What php_phars affects


  • downloads files (e.g.
  • saves them under a given name (e.g. composer) in an arbitrary directory (e.g. /usr/local/bin)
  • sets the owner (e.g. root)
  • sets the rights (e.g. a+x)

This operation can be executed:

  • all PHARS from the catalog
  • only chosen PHARS from the catalog
  • user defined PHARS

Setup Requirements

The module uses:

Beginning with php_phars

System wide install with Puppet

To install the module in your system run:

sudo puppet module install gajdaw-php_phars

You may lock the version to avoid using the latest version:

sudo puppet module install gajdaw-php_phars --version 0.1.0

System wide install with Git

You may also use git to install the module:

mkdir -p /etc/puppet/modules/php_phars
cd /etc/puppet/modules/php_phars
git clone --depth 1 .

To lock the version, use:

git clone --depth 1 --branch v0.1.0 .


For a more complete list of examples refer to examples/ directory.

Install all PHARS from the catalog

# Filename: examples/all.pp

class { 'php_phars':
    all => true,

You can run the example with:

sudo puppet apply examples/all.pp

The command will install all PHARS:


By default: PHARS are not redownloaded. Thus, when you run the command again and again:

sudo puppet apply examples/all.pp
sudo puppet apply examples/all.pp

nothing happens. To force redownload use redownload parameter.

Install/Update all PHARS from the catalog

# Filename: examples/all-redownload.pp

class { 'php_phars':
    all        => true,
    redownload => true,

You can run the example with:

sudo puppet apply examples/all-redownload.pp

This example redownloads PHARS every time you run it.

Install composer and phpunit only

# Filename: examples/only-composer-phpunit.pp

class { 'php_phars':
    phars      => ['composer', 'phpunit'],
    redownload => true,

You can run the example with:

sudo puppet apply examples/only-composer-phpunit.pp

Install all PHARS from the catalog and one special file

# Filename: examples/append-all.pp

class { 'php_phars':

    all => true,

    append => [
            'app' => 'symvirins',
            'url' => ''


You can run the example with:

sudo puppet apply examples/append-all.pp

The command will install all PHARS from the catalog and:


Running phar binaries (phpunit, composer, etc.)

If php is missing, install it with:

sudo apt-get install php5 -y

Now, you can use the binaries:

composer --version
phpunit --version
php-cs-fixer --version
box --version
behat --version
phpspec --version
symfony --version


Currently, to uninstall files, you have to use rm command:

sudo rm /usr/local/bin/composer
sudo rm /usr/local/bin/phpunit
sudo rm /usr/local/bin/php-cs-fixer
sudo rm /usr/local/bin/box
sudo rm /usr/local/bin/behat
sudo rm /usr/local/bin/phpspec
sudo rm /usr/local/bin/symfony


The complete list of parameters is available in manifests/fetch.pp file.

The catalog is an array of hashes:

# Filename: manifests/params.pp


$catalog = [
        'app' => 'composer',
        'url' => ''
        'app' => 'phpunit',
        'url' => ''
        'app' => 'php-cs-fixer',
        'url' => ''
        'app' => 'box',
        'url' => ''
        'app' => 'behat',
        'url' => ''
        'app' => 'phpspec',
        'url' => ''
        'app' => 'symfony',
        'url' => ''

The catalog contains the following PHARS:


The module was tested on:

  • Ubuntu
    • 12.04 / Puppet 3.7 (Vagrant box: ubuntu/precise32)
    • 14.04 / Puppet 3.7 (Vagrant box: ubuntu/trusty32)
  • CentOS
    • 6.5 / Puppet 3.7 (Vagrant box: puppetlabs/centos-6.5-64-puppet)
    • 7.0 / Puppet 3.7 (Vagrant box: puppetlabs/centos-7.0-64-puppet)
  • Debian
    • 6.0 / Puppet 3.7 (Vagrant box: chef/debian-6.0.8)
    • 7.4 / Puppet 3.7 (Vagrant box: chef/debian-7.4)
  • Fedora
    • 20 / Puppet 3.7 (Vagrant box: chef/fedora-20)

How to test this module?

Boot the VM:

$ vagrant up

Update Puppet to version 3.7.

Create symbolic links:

$ cd /vagrant
$ ./

Install dependencies:

$ sudo puppet module install puppetlabs-stdlib
$ sudo puppet module install maestrodev/wget


$ sudo puppet apply modules/puppet-php_phars/examples/only-composer-phpunit.pp

Install PHP.


$ composer --version
$ phpunit --version


For development instructions visit Puppet Modules Factory


The inspiration came from willdurrand-composer puppet module authored by William Durand.