2017 © Pedro Peláez
 

library phar-compact

Integrates the compact library with the phar library.

image

phine/phar-compact

Integrates the compact library with the phar library.

  • Wednesday, January 8, 2014
  • by kherge
  • Repository
  • 0 Watchers
  • 0 Stars
  • 505 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Phar Compact

Build Status Coverage Status Latest Stable Version Total Downloads, (*1)

Integrates the compact library with the phar library., (*2)

Requirement

Installation

Via Composer:, (*3)

$ composer require "phine/phar-compact=~1.0"

Usage

The library provides a single subject observer for lib-phar. This observer can be registered to the following subjects in order to compact file contents as they are being added to the archive:, (*4)

  • Builder::ADD_FILE
  • Builder::ADD_STRING

To create an observer, you will need a new instance of CompactObserver., (*5)

use Phine\Compact;
use Phine\Compact\Collection;
use Phine\Phar\Builder;
use Phine\Phar\Compact\CompactObserver;

// create the archive builder
$builder = Builder::create('example.phar');

// create the collection of compactors
$collection = new Collection();
$collection->addCompactor(new Compact\Json());
$collection->addCompactor(new Compact\Php());
$collection->addCompactor(new Compact\Xml());

// create the compactor observer
$observer = new CompactObserver($collection);

// register it with the builder subjects
$builder->observe(Builder::ADD_FILE, $observer);
$builder->observe(Builder::ADD_STRING, $observer);

With the observer registered, any time a file is added to the archive via the addFile() or addFromString() methods, the contents of the supported file types will be automatically compacted before being added to the archive., (*6)

Documentation

You can find the API documentation here., (*7)

License

This library is available under the MIT license., (*8)

The Versions

08/01 2014
08/01 2014