PHPackages                             carlosio/compify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. carlosio/compify

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

carlosio/compify
================

Including the tests and other useless information like .travis.yml in distributed packages is not a good idea. "Compify" tries to remove everything, in order to save bandwidth and disk usage, but the necessary code for the package to work in your app or library.

331721[4 issues](https://github.com/carlosbuenosvinos/compify/issues)PHP

Since Aug 4Pushed 9y ago5 watchersCompare

[ Source](https://github.com/carlosbuenosvinos/compify)[ Packagist](https://packagist.org/packages/carlosio/compify)[ RSS](/packages/carlosio-compify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Compify, save Composer disk and bandwith
========================================

[](#compify-save-composer-disk-and-bandwith)

Compify is a tool to save disk usage and bandwith in your composer vendor folder.

Maybe you haven't noticed, but if you take a look to your vendor folder after doing a `php composer.phar install` there are so much useless information like tests, `.travis.yml` like files that you just don't need in production.

Consider also packages installed from source (using `git clone` or `svn checkout`, not downloading a zip or methods base), they include folders like `.git` or `.svn` and, believe me, you don't want those folders in production.

In most of the cases, you will be deploying to production and storing different versions of your application, installing dependencies directly from your servers or rsyncing from a deployer machine. So, using compify you can save bandwith or time when deploying.

Installation
------------

[](#installation)

### Locally

[](#locally)

Download the [`compify.phar`](https://raw.github.com/carlosbuenosvinos/compify/master/compify.phar) file and store it somewhere on your computer.

### Globally

[](#globally)

You can run these commands to easily acces `compify` from anywhere on your system:

```
$ sudo https://github.com/carlosbuenosvinos/compify/raw/master/compify.phar -O /usr/local/bin/compify

```

then:

```
$ sudo chmod a+x /usr/local/bin/compify

```

and:

```
$ sudo vi /etc/php/php.ini
# search for "basedir"
# add ":/usr/local/bin" at the end and save

```

Then, just run `compify` in order to run compify

Update
------

[](#update)

### Locally

[](#locally-1)

The `self-update` command tries to update compify itself:

```
$ php compify.phar self-update

```

### Globally

[](#globally-1)

You can update compify through this command:

```
$ sudo compify self-update

```

Usage
-----

[](#usage)

```
php compify.phar crush --help
Usage:
 crush [vendor-path]

Arguments:
 vendor-path  Composer vendor path (default: "./vendor")

Help:
 The crush command removes all the
 unnecessary files for each composer
 package in order to save disk usage
 and bandwidth.

```

How does it work
----------------

[](#how-does-it-work)

Compify goes through every local composer dependency installed in your machine and removes typical unnecessary files and folders (what we call generic rules) for that package. Also, we have identified specific rules for specific packages that will also merge with the generic rules.

```
public static $rules = array(
    'generic-rules' => array(
        '.git',
        '.svn',
        'test',
        'tests',
        'docs',
        'doc',
        '.gitattributes',
        '.gitmodules',
        '.gitignore',
        '.travis.yml',
        'CHANGELOG*',
        'README*',
        'phpunit.xml.*',
        'LICENSE*'
    ),
    'packages-rules' => array(
        'twig/twig' => array(
            '.editorconfig',
            'AUTHORS',
            'ext'
        )
    )
);

```

You can contribute adding new package specific rules or any code update obsviously.

Example
-------

[](#example)

Let's assummed a small project with following composer.json

```
...
"require": {
    "twig/twig": ">=1.8,
