Minifies resources for the web
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
src
test
.gitignore
.scrutinizer.yml
.travis.yml
LICENSE
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

Minifine

Build Status Scrutinizer Code Quality Code Coverage GitHub license

Installation

Simply include this library into your projects using composer:

"require": {
    "peehaa/minifine": "^2"
},

Requirements

PHP 7+

Usage

Basic usage

Only a couple of lines are needed to use Minifine. First an instance needs to be created. After that you can start combining and minifying resources:

<?php
$minifier = (new \Minifine\Factory())->build('/path/to/resources', true);

<head>
    <meta charset="UTF-8">
    <title>Page title</title>
    <?= $minifier->css(['/css/bootstrap.min.css', '/css/jquery.ui.min.css', '/css/theme.css', '/css/custom.css'], '/css/min.css'); ?>
</head>

results in:

<head>
    <meta charset="UTF-8">
    <title>Page title</title>
    <link rel="stylesheet" href="/css/min.css">
</head>

And:

        <?= $minifier->js(['/js/jquery-1.11.2.min.js', '/js/bootstrap.min.js', '/js/custom.js'], '/js/min.js'); ?>
    </body>
</html>

results in:

        <script src="/js/min.js"></script>
    </body>
</html>

For more advanced usages like using different minifiers and/or chaining minifiers please consult the documentation.

Documentation

The documentation (including the contribution guidelines) can be found on the project's website.

License

MIT