Download the PHP package matthiasmullie/minify without Composer

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

Please rate this library. Is it a good library?
matthiasmullie/minify
Rate from 1 - 5
Rated 5.00 based on 2 reviews

All versions of minify with dependencies

Informations about the package minify

Minify

Build status Code coverage Code quality Latest version Downloads total License

Donate/Support: Support

Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns, such as:

JavaScript

CSS

And it comes with a huge test suite.

Usage

CSS

JS

Methods

Available methods, for both CSS & JS minifier, are:

__construct(/ overload paths /)

The object constructor accepts 0, 1 or multiple paths of files, or even complete CSS/JS content, that should be minified. All CSS/JS passed along, will be combined into 1 minified file.

add($path, / overload paths /)

This is roughly equivalent to the constructor.

minify($path)

This will minify the files' content, save the result to $path and return the resulting content. If the $path parameter is omitted, the result will not be written anywhere.

CAUTION: If you have CSS with relative paths (to imports, images, ...), you should always specify a target path! Then those relative paths will be adjusted in accordance with the new path.

gzip($path, $level)

Minifies and optionally saves to a file, just like minify(), but it also gzencode()s the minified content.

setMaxImportSize($size) (CSS only)

The CSS minifier will automatically embed referenced files (like images, fonts, ...) into the minified CSS, so they don't have to be fetched over multiple connections.

However, for really large files, it's likely better to load them separately (as it would increase the CSS load time if they were included.)

This method allows the max size of files to import into the minified CSS to be set (in kB). The default size is 5.

setImportExtensions($extensions) (CSS only)

The CSS minifier will automatically embed referenced files (like images, fonts, ...) into minified CSS, so they don't have to be fetched over multiple connections.

This methods allows the type of files to be specified, along with their data:mime type.

The default embedded file types are gif, png, jpg, jpeg, svg & woff.

Installation

Simply add a dependency on matthiasmullie/minify to your composer.json file if you use Composer to manage the dependencies of your project:

Although it's recommended to use Composer, you can actually include these files anyway you want.

License

Minify is MIT licensed.

Challenges

If you're interested in learning some of the harder technical challenges I've encountered building this, you probably want to take a look at what I wrote about it on my blog.


Version
Requires php Version >=5.3.0
ext-pcre Version *
matthiasmullie/path-converter Version ~1.1

The package matthiasmullie/minify contains the following files

Loading the files please wait ....