Download the PHP package psychowico/assets-compiler without Composer

On this page you can find all versions of the php package psychowico/assets-compiler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package assets-compiler

AssetsCompiler

AssetsCompiler is module for ZF2 that help you managment your project static files. For now it is responsible for combine and minifying CSS and Javascript files. It is in development state and in near future more features will be released.

It provides zend console route script to compile selected files as bundles and view helpers to automatically attaching bundles in your views. It can add files md5 to bundle file names - to avoid browser file caching after changes.

As bundle we understack pack of js/css files. In development mode all files from bundle are including to your site separately. In production - they are contacted and minimized to single bundle file and included in this way.

Installation

  1. Add "psychowico/assets-compiler": "dev-master" to your composer.json file and run php composer.phar update.
  2. Add AssetsCompiler to your config/application.config.php file under the modules key.

Minifier

Minifier classes provides zend console route script to compile selected files as bundles and view helpers to automatically attaching bundles in your views. It can add files md5 to bundle file names - to avoid browser file caching after changes.

Configuration

To make Minifier working you need declare your bundles lists and set your local directories. Easiest way is copy .../Minifier/config/minifier.global.php.dist file to config/autoload/minifier.global.php. Next you need proper fill configuration data inside minifier key. Most options have default values, you can found their in .../Minifier/config/module.config.php file.

Both, js and css configurations you can define by using this options:

List of bundles is a array where key is the bundle name, value is options array:

How to use

If you had configured your bundles and need combine and minify them just run your public/index.php file with cmds:

php index.php minify

It will do all job. To make it more easier and more intuitive you can create bin folder in your project root directory. There create minify file with the following content:

Do not forget to give file execute access! Now, when you are in your project root directory, you can just type: ./bin/minify

To make life even easier you should consider use Minifer view helpers. Minfier provides two view helpers for you. You can use in very similiar way to adding normal, static js and css files.

Bundle names are keys from above defined configuration, for sample: 'minifier'->'bundles'->'js'->'list'->'js_bundle'.

Analogously you can use prependJsBundle, prependCssBundle methods:

Remember that entries will be really rendered when you will echo zf2 headScript view helper or headLink in prependCssBundle case.

Now you can simply control that zend attach js/css files list, or just bundles files - but changing development_mode flag in your Minifier configuration.

Adapters

By default Minifier code use ..\Adapter\Minify adapter. It use matthiasmullie/minify php library, so you do not need install any additional stuff to start working. But if you have more needs you can use others prepared adapter or write you own. We provided three aditional adapters:

  1. \Adapter\Closure - using google Closure library, can compile only js
  2. \Adapter\UglifyJS2 - using UglifyJS2 library, only for js
  3. \Adapter\YUI - using YUI Compressor library from yahoo, can be use with js and css

They all external tools and need some configuration to start working with them. All can be configured in very similar way. In your configuration 'minifier' array you can add two keys, js_adapter for javascript adapter and css_adapter for css adapter. They both should be arrays like in example:

In similar way you can configure css_adapter, just remember that some adapters support only js! In exec param you need give your local path to library that you want use (Closure/UglifyJS2/YUI). In flags you can add additional parameters that will be send to compiler, for sample if you define flags like this:

uglify will be called in something like uglifyjs2 file1.js file2.js -o output_file.js --comments --define DEBUG=false.


All versions of assets-compiler with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
matthiasmullie/minify Version 1.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package psychowico/assets-compiler contains the following files

Loading the files please wait ....