PHPackages                             devfactory/minify - 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. devfactory/minify

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

devfactory/minify
=================

A package for minifying styles and javascript for laravel 5

2.0.2(1y ago)87363.5k↑29.8%30[4 issues](https://github.com/DevFactoryCH/minify/issues)[3 PRs](https://github.com/DevFactoryCH/minify/pulls)14MITPHPPHP ^8.1CI passing

Since Feb 5Pushed 1y ago13 watchersCompare

[ Source](https://github.com/DevFactoryCH/minify)[ Packagist](https://packagist.org/packages/devfactory/minify)[ RSS](/packages/devfactory-minify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (21)Used By (14)

Minify
======

[](#minify)

[![Build Status](https://camo.githubusercontent.com/4ab2fb1844db07746783eb8636a4c5b5ed19b6df63f39cde941a1c2cd17627c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f446576466163746f727943482f6d696e6966792f74657374732e796d6c)](https://github.com/DevFactoryCH/minify/actions/workflows/tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/19f4c4119af55a87b4e6abee8e09b6798553652a4700f8f8cbfbe816cc202117/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6d696e6966792f762f737461626c652e737667)](https://packagist.org/packages/devfactory/minify)[![Total Downloads](https://camo.githubusercontent.com/0e7bb2208dec18035a204497670e7572eb088260c56c272cb2777f04df435e52/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6d696e6966792f646f776e6c6f6164732e737667)](https://packagist.org/packages/devfactory/minify)[![License](https://camo.githubusercontent.com/14fd9bc048ca2a6faa7c932426cf213324be9046b61787f3c34741c4e57c718e/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6d696e6966792f6c6963656e73652e737667)](https://packagist.org/packages/devfactory/minify)

With this package you can minify your existing stylesheet and JavaScript files for Laravel 10. This process can be a little tough, this package simplifies and automates this process.

For Laravel 5 - 9 please use version 1.x of this package.

For Laravel 4 please use [ceesvanegmond/minify](https://github.com/ceesvanegmond/minify)

Installation
------------

[](#installation)

Begin by installing this package through Composer.

```
{
    "require": {
        "devfactory/minify": "^2.0"
    }
}
```

After the package installation, the `MinifyServiceProvider` and `Minify` facade are automatically registered. You can use the `Minify` facade anywhere in your application.

To publish the config file:

```
php artisan vendor:publish --provider="Devfactory\Minify\MinifyServiceProvider" --tag="config"
```

Upgrade to v2
-------------

[](#upgrade-to-v2)

Minify version 2 is PHP 8.1+ and Laravel 10+ only.

### Required upgrade changes

[](#required-upgrade-changes)

If the [`Devfactory\Minify\Contracts\MinifyInterface`](src/Contracts/MinifyInterface.php) interface is implemented, make sure update your implementation according to the updated types and exceptions.

If the [`Devfactory\Minify\Providers\BaseProvider`](src/Providers/BaseProvider.php) abstract class is used, make sure update your classes according to the updated types and exceptions.

The method `Devfactory\Minify\Providers\StyleSheet#urlCorrection` has been renamed to `Devfactory\Minify\Providers\StyleSheet#getFileContentWithCorrectedUrls`.

Rename the `minify.config.php` configuration file to `minify.php`.

Usage
-----

[](#usage)

### Stylesheet

[](#stylesheet)

```
// app/views/hello.blade.php

        ...
        {!! Minify::stylesheet('/css/main.css') !!}
        // or by passing multiple files
        {!! Minify::stylesheet(['/css/main.css', '/css/bootstrap.css']) !!}
        // add custom attributes
        {!! Minify::stylesheet(['/css/main.css', '/css/bootstrap.css'], ['foo' => 'bar']) !!}
        // add full uri of the resource
        {!! Minify::stylesheet(['/css/main.css', '/css/bootstrap.css'])->withFullUrl() !!}
        {!! Minify::stylesheet(['//fonts.googleapis.com/css?family=Roboto']) !!}

        // minify and combine all stylesheet files in given folder
        {!! Minify::stylesheetDir('/css/') !!}
        // add custom attributes to minify and combine all stylesheet files in given folder
        {!! Minify::stylesheetDir('/css/', ['foo' => 'bar', 'defer' => true]) !!}
        // minify and combine all stylesheet files in given folder with full uri
        {!! Minify::stylesheetDir('/css/')->withFullUrl() !!}

    ...

```

### Javascript

[](#javascript)

```
// app/views/hello.blade.php

    ...

    {!! Minify::javascript('/js/jquery.js') !!}
    // or by passing multiple files
    {!! Minify::javascript(['/js/jquery.js', '/js/jquery-ui.js']) !!}
    // add custom attributes
    {!! Minify::javascript(['/js/jquery.js', '/js/jquery-ui.js'], ['bar' => 'baz']) !!}
    // add full uri of the resource
    {!! Minify::javascript(['/js/jquery.js', '/js/jquery-ui.js'])->withFullUrl() !!}
    {!! Minify::javascript(['//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js']) !!}

    // minify and combine all javascript files in given folder
    {!! Minify::javascriptDir('/js/') !!}
    // add custom attributes to minify and combine all javascript files in given folder
    {!! Minify::javascriptDir('/js/', ['bar' => 'baz', 'async' => true]) !!}
    // minify and combine all javascript files in given folder with full uri
    {!! Minify::javascriptDir('/js/')->withFullUrl() !!}

```

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance42

Moderate activity, may be stable

Popularity51

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~204 days

Recently: every ~278 days

Total

19

Last Release

446d ago

Major Versions

1.0.14 → 2.0.02024-01-22

PHP version history (3 changes)1.0.0PHP &gt;=5.3.2

1.0.1PHP &gt;=5.4.0

2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/51b27ef81332de9328fd9d6c4e10156c73c33e86bd63e337eae3bb4985a956ff?d=identicon)[devfactory](/maintainers/devfactory)

---

Top Contributors

[![ceesvanegmond](https://avatars.githubusercontent.com/u/883497?v=4)](https://github.com/ceesvanegmond "ceesvanegmond (58 commits)")[![DevDavido](https://avatars.githubusercontent.com/u/997605?v=4)](https://github.com/DevDavido "DevDavido (20 commits)")[![sirsquall](https://avatars.githubusercontent.com/u/765946?v=4)](https://github.com/sirsquall "sirsquall (10 commits)")[![mean-cj](https://avatars.githubusercontent.com/u/1191385?v=4)](https://github.com/mean-cj "mean-cj (8 commits)")[![amalfra](https://avatars.githubusercontent.com/u/4033256?v=4)](https://github.com/amalfra "amalfra (7 commits)")[![markcameron](https://avatars.githubusercontent.com/u/1106894?v=4)](https://github.com/markcameron "markcameron (6 commits)")[![muta244](https://avatars.githubusercontent.com/u/10885339?v=4)](https://github.com/muta244 "muta244 (6 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![smgladkovskiy](https://avatars.githubusercontent.com/u/128070?v=4)](https://github.com/smgladkovskiy "smgladkovskiy (3 commits)")[![oriceon](https://avatars.githubusercontent.com/u/358823?v=4)](https://github.com/oriceon "oriceon (3 commits)")[![jorygeerts](https://avatars.githubusercontent.com/u/871427?v=4)](https://github.com/jorygeerts "jorygeerts (2 commits)")[![antal-levente](https://avatars.githubusercontent.com/u/63246047?v=4)](https://github.com/antal-levente "antal-levente (2 commits)")[![tobi76](https://avatars.githubusercontent.com/u/4992443?v=4)](https://github.com/tobi76 "tobi76 (2 commits)")[![niranjan94](https://avatars.githubusercontent.com/u/2404372?v=4)](https://github.com/niranjan94 "niranjan94 (2 commits)")[![xAockd](https://avatars.githubusercontent.com/u/3390348?v=4)](https://github.com/xAockd "xAockd (1 commits)")[![andryshok](https://avatars.githubusercontent.com/u/10627665?v=4)](https://github.com/andryshok "andryshok (1 commits)")[![atyagi](https://avatars.githubusercontent.com/u/1316495?v=4)](https://github.com/atyagi "atyagi (1 commits)")[![gandalfthegreydev](https://avatars.githubusercontent.com/u/170889551?v=4)](https://github.com/gandalfthegreydev "gandalfthegreydev (1 commits)")[![jimmyko](https://avatars.githubusercontent.com/u/3071329?v=4)](https://github.com/jimmyko "jimmyko (1 commits)")[![jrean](https://avatars.githubusercontent.com/u/5646128?v=4)](https://github.com/jrean "jrean (1 commits)")

---

Tags

minifylaravel5

### Embed Badge

![Health badge](/badges/devfactory-minify/health.svg)

```
[![Health](https://phpackages.com/badges/devfactory-minify/health.svg)](https://phpackages.com/packages/devfactory-minify)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k5.4k1](/packages/vinkius-labs-laravel-page-speed)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[goszowski/laravel-vendor-minify

A vendor minify package, to remove tests and documentation and minifing all php files to save space

803.6k](/packages/goszowski-laravel-vendor-minify)

PHPackages © 2026

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