PHPackages                             yyqsg888/laravel-minifier - 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. [Templating &amp; Views](/categories/templating)
4. /
5. yyqsg888/laravel-minifier

ActiveLibrary[Templating &amp; Views](/categories/templating)

yyqsg888/laravel-minifier
=========================

Minify your blade views, html, css and js files on the fly for Laravel 6, 7, 8, 9 and 10

v1.5.0(2y ago)1191↓33.3%MITPHPPHP &gt;=7.2.5

Since Feb 19Pushed 1y agoCompare

[ Source](https://github.com/yyqsg888/laravel-minify)[ Packagist](https://packagist.org/packages/yyqsg888/laravel-minifier)[ GitHub Sponsors](https://github.com/fahlisaputra)[ RSS](/packages/yyqsg888-laravel-minifier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (23)Used By (0)

[![Logo](assets/minify_logo.svg)](assets/minify_logo.svg)

Minify for Laravel
==================

[](#minify-for-laravel)

Minify for Laravel is a package for minifying and obfuscating Javascript, CSS, HTML and Blade views. It runs automatically when you load a page or view. Increase your website performance on page load and save bandwidth. Obfuscate your Javascript to protect your code from being stolen.

[![Latest Stable Version](https://camo.githubusercontent.com/d94fa748a877fcf0f3d889e14783a7d1420545226e3e9da55d4c7ebb81f6e584/687474703a2f2f706f7365722e707567782e6f72672f6661686c69736170757472612f6c61726176656c2d6d696e6966792f76)](https://packagist.org/packages/fahlisaputra/laravel-minify)[![Total Downloads](https://camo.githubusercontent.com/c521595f63d855dbadc25e557959af15694cf00e913a54b841ff74b6a95ada40/687474703a2f2f706f7365722e707567782e6f72672f6661686c69736170757472612f6c61726176656c2d6d696e6966792f646f776e6c6f616473)](https://packagist.org/packages/fahlisaputra/laravel-minify)[![License](https://camo.githubusercontent.com/8e53bf675675a42692eb02e7bbb11eeb273ba3db6b242fa88ea972c85b5703cd/687474703a2f2f706f7365722e707567782e6f72672f6661686c69736170757472612f6c61726176656c2d6d696e6966792f6c6963656e7365)](https://packagist.org/packages/fahlisaputra/laravel-minify)[![StyleCI](https://camo.githubusercontent.com/1b0820f038350e4b09a3a1c4ec7128d273a516cd3e7af696f8c17b599dcbf816/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3636373836303330392f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/667860309?branch=main)

Comparison
----------

[](#comparison)

This image shows the difference in size between the original file and the minified file of default welcome.blade.php Laravel. The original file size is 28.7 KB and the minified file size is 25.7 KB. The minified file size is 10% smaller than the original file size.

[![Logo](assets/comparison.png)](assets/comparison.png)

If you minify all your asset files, you can save up to 50% of your bandwidth. This will make your website load faster and save your hosting cost. When you have big files, the difference in size will be even greater.

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

[](#installation)

Minify for Laravel requires PHP 7.2 or higher. This particular version supports Laravel 8.x, 9.x, and 10.x.

To get the latest version, simply require the project using [Composer](https://getcomposer.org):

```
composer require yyqsg888/laravel-minifier
```

Configuration
-------------

[](#configuration)

Minify for Laravel supports optional configuration. To get started, you'll need to publish all vendor assets:

```
php artisan vendor:publish --provider="LaravelMinifier\Minify\MinifyServiceProvider"
```

This will create a config/minify.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

Register the Middleware
-----------------------

[](#register-the-middleware)

In order Minify for Laravel can intercept your request to minify and obfuscate, you need to add the Minify middleware to the `app/Http/Kernel.php` file:

```
protected $middleware = [
    ....
    // Middleware to minify CSS
    \LaravelMinifier\Minify\Middleware\MinifyCss::class,
    // Middleware to minify Javascript
    \LaravelMinifier\Minify\Middleware\MinifyJavascript::class,
    // Middleware to minify Blade
    \LaravelMinifier\Minify\Middleware\MinifyHtml::class,
];
```

You can choose which middleware you want to use. Put all of them if you want to minify html, css, and javascript at the same time.

Usage
-----

[](#usage)

This is how you can use Minify for Laravel in your project.

### Enable Minify

[](#enable-minify)

You can enable minify by setting `minify` to `true` in the `config/minify.php` file. For example:

```
"enabled" => env("MINIFY_ENABLED", true),
```

### Minify Asset Files

[](#minify-asset-files)

You must set `true` on `assets_enabled` in the `config/minify.php` file to minify your asset files. For example:

```
"assets_enabled" => env("MINIFY_ASSETS_ENABLED", true),
```

You can minify your asset files by using the `minify()` helper function. This function will minify your asset files and return the minify designed route. In order to work properly, you need to put your asset files in the `resources/js` or `resources/css` directory. For example:

```

```

where `test.css` is located in the `resources/css` directory.

```

```

where `test.js` is located in the `resources/js` directory.

### Automatic Insert Semicolon on Javascript or CSS

[](#automatic-insert-semicolon-on-javascript-or-css)

Use this option if Minify for Laravel makes your javascript or css not working properly. You can enable automatic insert semicolon on javascript or css by setting `true` on `insert_semicolon` in the `config/minify.php` file. For example:

```
"insert_semicolon" => [
    'css' => env("MINIFY_CSS_SEMICOLON", true),
    'js' => env("MINIFY_JS_SEMICOLON", true),
],
```

Caution: this option is experimental. If the code still not working properly, you can disable this option and add semicolon manually to your Javascript or CSS code.

### Skip Minify on Blade

[](#skip-minify-on-blade)

You can skip minify on blade by using attribute `ignore--minify` inside script or style tag. For example:

```

    /* css */

   /* javascript */

```

### Skip Minify when Rendering View

[](#skip-minify-when-rendering-view)

You can skip minify when rendering view by passing `ignore_minify = true` in the view data. For example:

```
return view('welcome', ['ignore_minify' => true]);
```

### Skip Minify by Route

[](#skip-minify-by-route)

You can skip minify by route by adding the route name to the `ignore` array in the `config/minify.php` file. For example:

```
"ignore" => [
    '/admin'
],
```

License
-------

[](#license)

Laravel Minify is licensed under the [MIT license](LICENSE).

Support
-------

[](#support)

This project was forked for private development purposes. Support is not provided. Please use original project  if support is needed.

Report Vulnerability
--------------------

[](#report-vulnerability)

Please read [our security policy](https://github.com/yyqsg888/laravel-minify/security/policy) for more details.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.6% 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.

###  Release Activity

Cadence

Every ~3 days

Total

22

Last Release

756d ago

PHP version history (2 changes)v1.0.0PHP ^7.2.5 || ^8.0

v1.4.4PHP &gt;=7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/746c9c04816557a9695c7c339379bea5b0189bc3b96a64d74d4cc5913125e279?d=identicon)[yyqsg888](/maintainers/yyqsg888)

---

Top Contributors

[![yyqsg888](https://avatars.githubusercontent.com/u/61581602?v=4)](https://github.com/yyqsg888 "yyqsg888 (43 commits)")[![fahlisaputra](https://avatars.githubusercontent.com/u/56981940?v=4)](https://github.com/fahlisaputra "fahlisaputra (30 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (3 commits)")

---

Tags

laravelhtml minifiercss-minifierjs-minifierjs-obfuscate

### Embed Badge

![Health badge](/badges/yyqsg888-laravel-minifier/health.svg)

```
[![Health](https://phpackages.com/badges/yyqsg888-laravel-minifier/health.svg)](https://phpackages.com/packages/yyqsg888-laravel-minifier)
```

###  Alternatives

[fahlisaputra/laravel-minify

Minify your blade views, html, css and obfuscate js files on the fly. Lightweight minifier for your Laravel project.

150157.0k1](/packages/fahlisaputra-laravel-minify)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

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