2017 © Pedro Peláez
 

composer-plugin 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.

image

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.

  • Thursday, August 4, 2016
  • by carlosbuenosvinos
  • Repository
  • 5 Watchers
  • 34 Stars
  • 166 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 3 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Compify, save Composer disk and bandwith

Compify is a tool to save disk usage and bandwith in your composer vendor folder., (*1)

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., (*2)

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., (*3)

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., (*4)

Installation

Locally

Download the compify.phar file and store it somewhere on your computer., (*5)

Globally

You can run these commands to easily acces compify from anywhere on your system:, (*6)

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

then:, (*7)

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

and:, (*8)

$ 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, (*9)

Update

Locally

The self-update command tries to update compify itself:, (*10)

$ php compify.phar self-update

Globally

You can update compify through this command:, (*11)

$ sudo compify self-update

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

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., (*12)

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., (*13)

Example

Let's assummed a small project with following composer.json, (*14)

...
"require": {
    "twig/twig": ">=1.8,<2.0-dev",
    "symfony/twig-bridge": "2.1.*",
    "swiftmailer/swiftmailer": "4.3.x-dev",
    "symfony/console": "2.1.*",
    "doctrine/dbal": "2.3.*",
    "silex/silex": "1.0.*",
    "guzzle/guzzle": "3.0.*"
},
...

$ php compify.phar crush
Crushing vendors (by Carlos Buenosvinos)
Vendor size before crushing: 73M
Vendor size after crushing: 18M

Do you need more arguments?, (*15)

More Information

For any issue use PR github system, for other info, send me an email to carlos.buenosvinos@gmail.com, (*16)

License

Compify is licensed under the MIT license., (*17)

The Versions

04/08 2016

dev-master

9999999-dev https://github.com/carlosbuenosvinos/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.

  Sources   Download

MIT

The Requires

 

composer bandwidth