1# JShrink [![Build Status](https://travis-ci.org/tedious/JShrink.svg?branch=master)](https://travis-ci.org/tedivm/JShrink)
2
3[![License](http://img.shields.io/packagist/l/tedivm/JShrink.svg)](https://github.com/tedivm/JShrink/blob/master/LICENSE)
4[![Latest Stable Version](http://img.shields.io/github/release/tedious/JShrink.svg)](https://packagist.org/packages/tedivm/JShrink)
5[![Coverage Status](https://coveralls.io/repos/tedious/JShrink/badge.png?branch=master)](https://coveralls.io/r/tedivm/JShrink?branch=master)
6[![Total Downloads](http://img.shields.io/packagist/dt/tedivm/jshrink.svg)](https://packagist.org/packages/tedivm/JShrink)
7
8JShrink is a php class that minifies javascript so that it can be delivered to the client quicker. This code can be used
9by any product looking to minify their javascript on the fly (although caching the results is suggested for performance
10reasons). Unlike many other products this is not a port into php but a native application, resulting in better
11performance.
12
13
14## Usage
15
16Minifying your code is simple call to a static function-
17
18```php
19<?php
20include('vendor/autoload.php');
21
22// Basic (default) usage.
23$minifiedCode = \JShrink\Minifier::minify($js);
24
25// Disable YUI style comment preservation.
26$minifiedCode = \JShrink\Minifier::minify($js, array('flaggedComments' => false));
27```
28
29
30## Results
31
32* Raw - 586,990
33* Gzip - 151,301
34* JShrink - 371,982
35* JShrink and Gzip - 93,507
36
37
38## Installing
39
40### Composer
41
42Installing JShrink can be done through a variety of methods, although Composer is
43recommended.
44
45```yaml
46"require": {
47  "tedivm/jshrink": "~1.0"
48}
49```
50
51### Github
52
53Releases of JShrink are available on [Github](https://github.com/tedious/JShrink/releases).
54
55
56## License
57
58JShrink is licensed under the BSD License. See the LICENSE file for details.
59
60In the spirit of open source, use of this library for evil is discouraged but not prohibited.
61
62
63## Reporting Security and Vulnerability Issues
64
65This project utilizes the [Tidelift Security Reporting System](https://tidelift.com/security) for security and vulnerability reporting.
66
67
68## Support
69
70Issues can be opened directly in Github for issues that aren't related to security.
71
72[Professionally supported JShrink is now available with Tidelift.](https://tidelift.com/subscription/pkg/packagist-tedivm-jshrink?utm_source=packagist-tedivm-jshrink&utm_medium=referral&utm_campaign=readme)
73