PHPackages                             dotninth/laravel-tachyon - 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. dotninth/laravel-tachyon

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

dotninth/laravel-tachyon
========================

Laravel Tachyon is a package designed to optimize the performance of your Laravel applications by optimizing and minifying HTML output on demand.

v4.2.0(4mo ago)71801[1 issues](https://github.com/dotninth/laravel-tachyon/issues)MITPHPPHP ^8.3

Since Aug 1Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/dotninth/laravel-tachyon)[ Packagist](https://packagist.org/packages/dotninth/laravel-tachyon)[ RSS](/packages/dotninth-laravel-tachyon/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (12)Used By (0)

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://supportukrainenow.org/)

 [ ![Laravel Tachyon](./.github/assets/laravel-tachyon-light.svg) ](https://github.com/dotninth/laravel-tachyon#gh-light-mode-only) [ ![Laravel Tachyon](./.github/assets/laravel-tachyon-dark.svg) ](https://github.com/dotninth/laravel-tachyon#gh-dark-mode-only)
====================================================================================================================================================================================================================================================================

[](#--------------------------------)

####  [![Latest Stable Version](https://camo.githubusercontent.com/a76e2e6c0f3eb99ca5426b204e24f163e340dd814905c70d332af9fa3be6f833/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76342e322e302d76657273696f6e3f7374796c653d666f722d7468652d626164676526636f6c6f723d433943424646266c6162656c436f6c6f723d333032443431266c6162656c3d76657273696f6e)](https://camo.githubusercontent.com/a76e2e6c0f3eb99ca5426b204e24f163e340dd814905c70d332af9fa3be6f833/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76342e322e302d76657273696f6e3f7374796c653d666f722d7468652d626164676526636f6c6f723d433943424646266c6162656c436f6c6f723d333032443431266c6162656c3d76657273696f6e) [![Required PHP Version](https://camo.githubusercontent.com/16f45e693271066b3bee5e19e7e16c73fe1485e51cc5f3ea5fd78f1720e39140/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f382e332d7068705f76657273696f6e3f7374796c653d666f722d7468652d626164676526636f6c6f723d383964636562266c6162656c436f6c6f723d333032443431266c6162656c3d706870)](https://camo.githubusercontent.com/16f45e693271066b3bee5e19e7e16c73fe1485e51cc5f3ea5fd78f1720e39140/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f382e332d7068705f76657273696f6e3f7374796c653d666f722d7468652d626164676526636f6c6f723d383964636562266c6162656c436f6c6f723d333032443431266c6162656c3d706870) [![Required Laravel Version](https://camo.githubusercontent.com/69068efbbb0e5d7c275ef65d437edb12ad770a2e8c1c3ac87f7c37eb0ce30bda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f31322d6c61726176656c5f76657273696f6e3f7374796c653d666f722d7468652d626164676526636f6c6f723d656639663736266c6162656c436f6c6f723d333032443431266c6162656c3d6c61726176656c)](https://camo.githubusercontent.com/69068efbbb0e5d7c275ef65d437edb12ad770a2e8c1c3ac87f7c37eb0ce30bda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f31322d6c61726176656c5f76657273696f6e3f7374796c653d666f722d7468652d626164676526636f6c6f723d656639663736266c6162656c436f6c6f723d333032443431266c6162656c3d6c61726176656c) [![License](https://camo.githubusercontent.com/c1d59e9f134ce2866a958affa3b9b4979fd49f890f4bd446e3e2dcc16dc6a519/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d49542d6c6963656e73653f7374796c653d666f722d7468652d626164676526636f6c6f723d636261366637266c6162656c436f6c6f723d333032443431266c6162656c3d6c6963656e7365)](https://camo.githubusercontent.com/c1d59e9f134ce2866a958affa3b9b4979fd49f890f4bd446e3e2dcc16dc6a519/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d49542d6c6963656e73653f7374796c653d666f722d7468652d626164676526636f6c6f723d636261366637266c6162656c436f6c6f723d333032443431266c6162656c3d6c6963656e7365)

[](#----------------)

🚀 Introduction
--------------

[](#-introduction)

`Laravel Tachyon` is a powerful package designed to optimize the performance of your Laravel applications by minifying HTML output on demand. With over 35% optimization, it helps improve page load speed and overall user experience.

**Laravel Tachyon** supports the following:

- **Laravel Livewire**: Laravel Tachyon seamlessly integrates with Laravel Livewire, allowing you to optimize the HTML output of your Livewire components.
- **Alpine JS**: Laravel Tachyon is compatible with Alpine JS, ensuring that the optimization process does not interfere with the functionality of your Alpine JS components.

Additionally, **Laravel Tachyon** ensures that the optimization process does not break the following HTML elements:

- ``: The content within `` tags, which is typically used for displaying preformatted text, is preserved and not modified during the optimization process.
- ``: The content within `` tags, which is used for input fields that allow multiple lines of text, is also preserved and not modified.
- ``: The content within `` tags, which is used for JavaScript code, is not modified by Laravel Tachyon. This ensures that your JavaScript code remains intact and functions as expected.

🏁 Getting Started
-----------------

[](#-getting-started)

### Requirements

[](#requirements)

- **[PHP 8.3+](https://php.net/releases/)**
- **[Laravel 12.0+](https://github.com/laravel/laravel)**

### Installation

[](#installation)

You can install the package via composer:

```
composer require dotninth/laravel-tachyon
```

This package supports Laravel [Package Discovery](https://laravel.com/docs/12.x/packages#package-discovery).

#### Publish configuration file

[](#publish-configuration-file)

To customize the package settings, you can publish the configuration file with the following command:

```
php artisan vendor:publish --provider="DotNinth\LaravelTachyon\ServiceProvider"
```

### Middleware Registration

[](#middleware-registration)

To enable the package functionality, make sure to register the provided middlewares in the `bootstrap/app.php` file of your Laravel application. Here's an example of how to do it:

```
// bootstrap/app.php

return Application::configure(basePath: dirname(__DIR__))
    ...
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->append([
            \DotNinth\LaravelTachyon\Middleware\RemoveComments::class,
            \DotNinth\LaravelTachyon\Middleware\CollapseWhitespace::class,
            \DotNinth\LaravelTachyon\Middleware\ElideAttributes::class,
            \DotNinth\LaravelTachyon\Middleware\InlineCss::class,
            \DotNinth\LaravelTachyon\Middleware\InsertDNSPrefetch::class,
            \DotNinth\LaravelTachyon\Middleware\DeferJavascript::class,
        ]);
    })
    ...
```

🛠️ Middlewares Details
----------------------

[](#️-middlewares-details)

- `RemoveComments::class`
    - Removes HTML, JS, and CSS comments from the output to reduce the transfer size of HTML files.
- `CollapseWhitespace::class`
    - Reduces the size of HTML files by removing unnecessary white space.
- `RemoveQuotes::class`
    - Removes unnecessary quotes from HTML attributes, resulting in a reduced byte count on most pages.
- `ElideAttributes::class`
    - Reduces the transfer size of HTML files by removing attributes from tags if their values match the default attribute values.
- `InsertDNSPrefetch::class`
    - Includes `` tags in the HTML `` section to enable DNS prefetching, reducing DNS lookup time and improving page load times.
- `TrimUrls::class`
    - Trims URLs by making them relative to the base URL of the page. This can help reduce the size of URLs and may improve performance.
- `InlineCss::class`
    - Transforms the inline `style` attribute of HTML tags into classes by moving the CSS into the `` section, improving page rendering and reducing the number of browser requests.
- `DeferJavascript::class`
    - Defers the execution of JavaScript code in HTML, prioritizing the rendering of critical content before executing JavaScript.
        - If you need **to cancel the defer** in some script, use `data-tachyon-no-defer` as a script attribute to cancel the defer.

Warning

Use `TrimUrls::class` middleware with care, as it can cause problems if the wrong base URL is used.

Important

`CollapseWhitespace::class` automatically calls the `RemoveComments::class` middleware before executing.

Note

You can **ignore** minification of some elements. Add `data-tachyon-ignore` as an element attribute to do so.

⚙️ Configuration
----------------

[](#️-configuration)

After installing the package, you may need to configure some options according to your needs.

### Disable Service

[](#disable-service)

To disable the Laravel Tachyon service in your local environment and get readable output, modify the following configuration file:

```
// config/laravel-tachyon.php

//Set this field to false to disable the Laravel Tachyon service.
'enable' => env('LARAVEL_TACHYON_ENABLED', true),
```

### Skip routes

[](#skip-routes)

You can configure the package to skip optimization for certain routes. Use the `*` wildcard to match multiple routes. Here's an example:

```
// config/laravel-tachyon.php

//You can use * as wildcard.
'skip' => [
    '*.pdf', //Ignore all routes with final .pdf
    '*/downloads/*',//Ignore all routes that contain 'downloads'
    'assets/*', // Ignore all routes with the 'assets' prefix
];
```

Feel free to adjust the configuration options according to your specific needs.

> ***Notice:*** By default, the package automatically skips `binary` and `streamed` responses. See the [File Downloads](https://laravel.com/docs/12.x/responses#file-downloads) for more information.

🧪 Testing
---------

[](#-testing)

```
$ composer test
```

🤝 Contributing
--------------

[](#-contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance71

Regular maintenance activity

Popularity19

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~87 days

Recently: every ~205 days

Total

11

Last Release

146d ago

Major Versions

v2.1.1 → v3.0.02023-08-11

v3.2.2 → v4.0.02024-10-19

PHP version history (3 changes)v2.1.1PHP ^8.0

v4.0.0PHP ^8.2

v4.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/41db62ca6886bcd35259d6b5ae633f3c73de98e5c90de31848646afb62981eb8?d=identicon)[dotninth](/maintainers/dotninth)

---

Top Contributors

[![dotninth](https://avatars.githubusercontent.com/u/25880190?v=4)](https://github.com/dotninth "dotninth (93 commits)")[![joaorobertopb](https://avatars.githubusercontent.com/u/6556083?v=4)](https://github.com/joaorobertopb "joaorobertopb (63 commits)")[![lucasMesquitaBorges](https://avatars.githubusercontent.com/u/42281497?v=4)](https://github.com/lucasMesquitaBorges "lucasMesquitaBorges (19 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (5 commits)")[![stakahashi](https://avatars.githubusercontent.com/u/3667416?v=4)](https://github.com/stakahashi "stakahashi (5 commits)")[![tswestendorp](https://avatars.githubusercontent.com/u/1061961?v=4)](https://github.com/tswestendorp "tswestendorp (5 commits)")[![renatomarinho](https://avatars.githubusercontent.com/u/26571?v=4)](https://github.com/renatomarinho "renatomarinho (3 commits)")[![saifulwebid](https://avatars.githubusercontent.com/u/1644410?v=4)](https://github.com/saifulwebid "saifulwebid (2 commits)")[![kenzouno1](https://avatars.githubusercontent.com/u/1946802?v=4)](https://github.com/kenzouno1 "kenzouno1 (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![caneco](https://avatars.githubusercontent.com/u/502041?v=4)](https://github.com/caneco "caneco (1 commits)")[![nikonor909](https://avatars.githubusercontent.com/u/6659210?v=4)](https://github.com/nikonor909 "nikonor909 (1 commits)")[![patrickbrouwers](https://avatars.githubusercontent.com/u/7728097?v=4)](https://github.com/patrickbrouwers "patrickbrouwers (1 commits)")[![percymamedy](https://avatars.githubusercontent.com/u/11259669?v=4)](https://github.com/percymamedy "percymamedy (1 commits)")[![tvbeek](https://avatars.githubusercontent.com/u/2026498?v=4)](https://github.com/tvbeek "tvbeek (1 commits)")[![swilla](https://avatars.githubusercontent.com/u/304159?v=4)](https://github.com/swilla "swilla (1 commits)")[![andysnell](https://avatars.githubusercontent.com/u/7006523?v=4)](https://github.com/andysnell "andysnell (1 commits)")[![f-liva](https://avatars.githubusercontent.com/u/346224?v=4)](https://github.com/f-liva "f-liva (1 commits)")[![JapSeyz](https://avatars.githubusercontent.com/u/2234034?v=4)](https://github.com/JapSeyz "JapSeyz (1 commits)")[![gofish543](https://avatars.githubusercontent.com/u/10394554?v=4)](https://github.com/gofish543 "gofish543 (1 commits)")

---

Tags

alpinedns-prefetchhtml-minificationlaravellaravel-packagelivewirepage-loading-speedperformance-optimizationuser-experiencelaravelhtmlminifylivewirepage-speedalpinejsoptimizehtmx

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/dotninth-laravel-tachyon/health.svg)

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

###  Alternatives

[vinkius-labs/laravel-page-speed

Laravel Page Speed

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

Laravel Page Speed

2.5k1.7M10](/packages/renatomarinho-laravel-page-speed)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[okipa/laravel-table

Generate tables from Eloquent models.

56752.8k](/packages/okipa-laravel-table)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[mischasigtermans/laravel-altitude

Claude Code agents for the TALL stack, powered by Laravel Boost

1139.2k](/packages/mischasigtermans-laravel-altitude)

PHPackages © 2026

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