PHPackages                             d3catalyst/l4-resource-compress - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. d3catalyst/l4-resource-compress

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

d3catalyst/l4-resource-compress
===============================

Laravel 4 Library for compress resources, jpg, png, css and js files, powered by cssminifier.com.

5211PHPCI failing

Since Jul 31Pushed 11y ago2 watchersCompare

[ Source](https://github.com/D3Catalyst/laravel-4-resource-compress)[ Packagist](https://packagist.org/packages/d3catalyst/l4-resource-compress)[ RSS](/packages/d3catalyst-l4-resource-compress/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-4-resource-compress
===========================

[](#laravel-4-resource-compress)

[![Build Status](https://camo.githubusercontent.com/734540edd8db52b6d06eef369f8b2b5a7cc8a9e4946981ba3dc97a2e49b5091c/68747470733a2f2f7472617669732d63692e6f72672f4433436174616c7973742f6c61726176656c2d342d7265736f757263652d636f6d70726573732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/D3Catalyst/laravel-4-resource-compress) [![Latest Stable Version](https://camo.githubusercontent.com/b72b083843bc9c27ae0cf656486acd934f773665c8b3b788841ce9a1c448b9e9/68747470733a2f2f706f7365722e707567782e6f72672f6433636174616c7973742f6c342d7265736f757263652d636f6d70726573732f762f737461626c652e737667)](https://packagist.org/packages/d3catalyst/l4-resource-compress) [![Total Downloads](https://camo.githubusercontent.com/1e6ff780d54f53b22eeeac308db764f9ce5f15c0cda3cc1129eb89d06a46d20c/68747470733a2f2f706f7365722e707567782e6f72672f6433636174616c7973742f6c342d7265736f757263652d636f6d70726573732f646f776e6c6f6164732e737667)](https://packagist.org/packages/d3catalyst/l4-resource-compress) [![Latest Unstable Version](https://camo.githubusercontent.com/e8c0ee4a5167af887a5c278c0fb2b484f179319b152fa7a966b402b04bdd057b/68747470733a2f2f706f7365722e707567782e6f72672f6433636174616c7973742f6c342d7265736f757263652d636f6d70726573732f762f756e737461626c652e737667)](https://packagist.org/packages/d3catalyst/l4-resource-compress) [![License](https://camo.githubusercontent.com/c2a43167ded91fcb0188b3fd465e175aaa531300ac664c56ab8497c1efb4337b/68747470733a2f2f706f7365722e707567782e6f72672f6433636174616c7973742f6c342d7265736f757263652d636f6d70726573732f6c6963656e73652e737667)](https://packagist.org/packages/d3catalyst/l4-resource-compress) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/600f6c47d2305f4518efe10aa7758a84934d234ef53500997027d6c546fe814e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4433436174616c7973742f6c61726176656c2d342d7265736f757263652d636f6d70726573732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/D3Catalyst/laravel-4-resource-compress/?branch=master)

Laravel 4 Library for calling  API.

This library provides an easy way to make the resource's optimizations, png, jpg, css adn javascript.

Just install the package, add the config and it is ready to use!

Requirements
============

[](#requirements)

- PHP &gt;= 5.5.0
- cURL Extension

Installation
============

[](#installation)

Add in composer.json "d3catalyst/l4-resource-compress"

Add the service provider and facade in your config/app.php

Service Provider

```
'D3Catalyst\Compress\Laravel4\ServiceProviders\CompressServiceProvider'

```

Facade

```
'Compress'           => 'D3Catalyst\Compress\Laravel4\Facades\Compress',

```

Usage
=====

[](#usage)

Default uncompress and compressed resource path's.

```
public_path('d3compress/full/')
public_path('d3compress/min/')

```

Set diferent uncompressed path

```
Compress::setUncompressedPath('new/path/uncompressed/')

```

Set diferent compressed path

```
Compress::setUncompressedPath('new/path/compressed/')

```

Optimise PNG file

```
Compress::png('image.png')

return Array (
			    [mime_type] => image/png
			    [original_file] => /original/path/full/image.png
			    [optimized_file] => /original/path/min/image_opt.png
			    [original_zize] => 1078921
			    [optimized_zize] => 1067163
			)

```

Optimise lot of png images

```
$pngImgLot = ['pngs/png1.png','pngs/png2.png','pngs/png3.png']

Compress::pngLot($pngImgLot)

return Array (
			    [pngs/png1.png] => Array
			        (
			            [mime_type] => image/png
			            [original_file] => /original/path/full/pngs/png1.png
			            [optimized_file] => /original/path/min/png1_opt.png
			            [original_zize] => 1078921
			            [optimized_zize] => 1067163
			        )

			    [pngs/png2.png] => Array
			        (
			            [mime_type] => image/png
			            [original_file] => /original/path/full/pngs/png2.png
			            [optimized_file] => /original/path/min/png2_opt.png
			            [original_zize] => 930396
			            [optimized_zize] => 884592
			        )

			    [pngs/png3.png] => Array
			        (
			            [mime_type] => image/png
			            [original_file] => /original/path/full/pngs/png3.png
			            [optimized_file] => /original/path/min/png3_opt.png
			            [original_zize] => 615815
			            [optimized_zize] => 592042
			        )

			)

```

Optimise JPG file

```
Compress::jpg('image.png')

return Array (
			    [mime_type] => image/jpeg
			    [original_file] => /original/path/full/image.jpg
			    [optimized_file] => /original/path/min/image_opt.jpg
			    [original_zize] => 1078921
			    [optimized_zize] => 1067163
			)

```

Optimise lot of jpg images

```
$jpgImgLot = ['jpgs/jpg1.jpg','jpgs/jpg2.jpg','jpgs/jpg3.jpg']

Compress::jpgLot($jpgImgLot)

return Array (
			    [jpgs/jpg1.jpg] => Array
			        (
			            [mime_type] => image/jpeg
			            [original_file] => /original/path/full/jpgs/jpg1.jpg
			            [optimized_file] => /original/path/min/jpg1_opt.jpg
			            [original_size] => 904706
			            [optimized_size] => 904450
			        )

			    [jpgs/jpg2.jpg] => Array
			        (
			            [mime_type] => image/jpeg
			            [original_file] => /original/path/full/jpgs/jpg2.jpg
			            [optimized_file] => /original/path/min/jpg2_opt.jpg
			            [original_size] => 517780
			            [optimized_size] => 505848
			        )

			    [jpgs/jpg3.jpg] => Array
			        (
			            [mime_type] => image/jpeg
			            [original_file] => /original/path/full/jpgs/jpg3.jpg
			            [optimized_file] => /original/path/min/jpg3_opt.jpg
			            [original_size] => 382038
			            [optimized_size] => 381646
			        )

			)

```

Optimise CSS file

```
Compress::css('style.css')

return Array (
			    [mime_type] => text/plain
			    [original_file] => /original/path/style.css
			    [optimized_file] => /original/path/min/style.min.css
			    [original_zize] => 1078921
			    [optimized_zize] => 1067163
			)

```

Optimise lot of css files

```
$cssLot = ['style1.css','style2.css','style2.css']

Compress::cssLot($cssLot)

return Array (
			    [style1.css] => Array
			        (
			            [mime_type] => text/plain
			            [original_file] => /original/path/full/style1.css
			            [optimized_file] => /original/path/min/style1.min.css
			            [original_size] => 9171
			            [optimized_size] => 7660
			        )

			    [style2.css] => Array
			        (
			            [mime_type] => text/plain
			            [original_file] => /original/path/full/style2.css
			            [optimized_file] => /original/path/min/style2.min.css
			            [original_size] => 104661
			            [optimized_size] => 86303
			        )

			    [style3.css] => Array
			        (
			            [mime_type] => text/plain
			            [original_file] => /original/path/full/style3.css
			            [optimized_file] => /original/path/min/style3.min.css
			            [original_size] => 243
			            [optimized_size] => 46
			        )

			)

```

Merge and compress css files

```
$cssLot = ['style1.css','style2.css','style2.css']

Compress::mergeCssLot($cssLot)

return Array (
			    [mime_type] => text/plain
			    [original_file] => /original/path/full/b6a546c214c70710bf1d92df4bb305ed.css
			    [optimized_file] => /original/path/min/b6a546c214c70710bf1d92df4bb305ed.min.css
			    [original_size] => 113801
			    [optimized_size] => 88074
			)

$cssLot = ['style1.css','style2.css','style2.css']

Compress::mergeCssLot($cssLot, 'Othername')

return Array (
			    [mime_type] => text/plain
			    [original_file] => /original/path/full/Othername.css
			    [optimized_file] => /original/path/min/Othername.min.css
			    [original_size] => 113801
			    [optimized_size] => 88074
			)

```

Optimise JS file

```
Compress::js('script.js')

return Array (
			    [mime_type] => text/plain
			    [original_file] => /original/path/script.js
			    [optimized_file] => /original/path/min/script.min.js
			    [original_zize] => 1078921
			    [optimized_zize] => 1067163
			)

```

Optimise lot of js files

```
$jsLot = ['script1.js','script3.js','script3.js'];

Compress::jsLot($jsLot)

return Array (
			    [script1.js] => Array
			        (
			            [mime_type] => text/plain
			            [original_file] => /original/path/full/script1.js
			            [optimized_file] => /original/path/min/script1.min.js
			            [original_size] => 9171
			            [optimized_size] => 7660
			        )

			    [script2.js] => Array
			        (
			            [mime_type] => text/plain
			            [original_file] => /original/path/full/script2.js
			            [optimized_file] => /original/path/min/script2.min.js
			            [original_size] => 104661
			            [optimized_size] => 86303
			        )

			    [script3.js] => Array
			        (
			            [mime_type] => text/plain
			            [original_file] => /original/path/full/script3.js
			            [optimized_file] => /original/path/min/script3.min.js
			            [original_size] => 243
			            [optimized_size] => 46
			        )

			)

```

Merge and compress js files

```
$jsLot = ['script1.js','script2.js','script2.js']

Compress::mergeJsLot($jsLot)

return Array (
			    [mime_type] => text/plain
			    [original_file] => /original/path/full/b6a546c214c70710bf1d92df4bb305ed.js
			    [optimized_file] => /original/path/min/b6a546c214c70710bf1d92df4bb305ed.min.js
			    [original_size] => 113801
			    [optimized_size] => 88074
			)

$jsLot = ['script1.js','script2.js','script2.js']

Compress::mergeJsLot($jsLot, 'Othername')

return Array (
			    [mime_type] => text/plain
			    [original_file] => /original/path/full/Othername.js
			    [optimized_file] => /original/path/min/Othername.min.js
			    [original_size] => 113801
			    [optimized_size] => 88074
			)

```

If you want see debug info

```
print_r(Compress::getDebugData())

```

See on fly error

```
JPG

if(Compress::jpg("file...")===false) {
	echo Compress::getErrorData();
}

PNG

if(Compress::png("file...")===false) {
	echo Compress::getErrorData();
}

CSS

if(Compress::css("file...")===false) {
	echo Compress::getErrorData();
}

JS

if(Compress::js("file...")===false) {
	echo Compress::getErrorData();
}

JPG Lot

if(Compress::jpgLot("array...")===false) {
	echo Compress::getErrorData();
}

PNG Lot

if(Compress::pngLot("array...")===false) {
	echo Compress::getErrorData();
}

CSS Lot

if(Compress::cssLot("array...")===false) {
	echo Compress::getErrorData();
}

Merge CSS Lot

if(Compress::mergeCssLot("array...")===false) {
	echo Compress::getErrorData();
}

JS Lot

if(Compress::jsLot("array...")===false) {
	echo Compress::getErrorData();
}

Merge JS Lot

if(Compress::mergeJsLot("array...")===false) {
	echo Compress::getErrorData();
}

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a5a0fb36baa59e88e6e67fb4049df8c3794ae237e1583de6fb8dfabcda293f7?d=identicon)[d3v1an](/maintainers/d3v1an)

---

Top Contributors

[![D3Catalyst](https://avatars.githubusercontent.com/u/6761108?v=4)](https://github.com/D3Catalyst "D3Catalyst (37 commits)")

### Embed Badge

![Health badge](/badges/d3catalyst-l4-resource-compress/health.svg)

```
[![Health](https://phpackages.com/badges/d3catalyst-l4-resource-compress/health.svg)](https://phpackages.com/packages/d3catalyst-l4-resource-compress)
```

###  Alternatives

[spaze/csp-config

Build Content Security Policy from a config file

143.3k](/packages/spaze-csp-config)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
