{"id":15164530,"url":"https://github.com/dotninth/laravel-tachyon","last_synced_at":"2025-09-30T19:31:26.964Z","repository":{"id":185369992,"uuid":"673472745","full_name":"dotninth/laravel-tachyon","owner":"dotninth","description":"Turbo-boost page load speeds with HTML minification and optimization.","archived":false,"fork":true,"pushed_at":"2024-10-19T16:56:12.000Z","size":312,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-16T20:56:23.046Z","etag":null,"topics":["alpine","dns-prefetch","html-minification","laravel","laravel-package","livewire","page-loading-speed","performance-optimization","user-experience"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"renatomarinho/laravel-page-speed","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotninth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-01T17:47:54.000Z","updated_at":"2024-10-19T16:56:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dotninth/laravel-tachyon","commit_stats":null,"previous_names":["dotninth/laravel-page-speed","dotninth/laravel-tachyon","ideal-creative-lab/laravel-tachyon","yard77/laravel-tachyon"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotninth%2Flaravel-tachyon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotninth%2Flaravel-tachyon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotninth%2Flaravel-tachyon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotninth%2Flaravel-tachyon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotninth","download_url":"https://codeload.github.com/dotninth/laravel-tachyon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234767230,"owners_count":18883405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine","dns-prefetch","html-minification","laravel","laravel-package","livewire","page-loading-speed","performance-optimization","user-experience"],"created_at":"2024-09-27T03:25:02.632Z","updated_at":"2025-09-30T19:31:26.958Z","avatar_url":"https://github.com/dotninth.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://supportukrainenow.org/)\n\n\u003cbr\u003e\n\n\u003ch1 align=\"center\"\u003e\n    \u003ca href=\"https://github.com/dotninth/laravel-tachyon#gh-light-mode-only\"\u003e\n        \u003cimg src=\"./.github/assets/laravel-tachyon-light.svg\" alt=\"Laravel Tachyon\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/dotninth/laravel-tachyon#gh-dark-mode-only\"\u003e\n        \u003cimg src=\"./.github/assets/laravel-tachyon-dark.svg\" alt=\"Laravel Tachyon\"\u003e\n    \u003c/a\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/v4.1.0-version?style=for-the-badge\u0026color=C9CBFF\u0026labelColor=302D41\u0026label=version\" alt=\"Latest Stable Version\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/8.2-php_version?style=for-the-badge\u0026color=89dceb\u0026labelColor=302D41\u0026label=php\" alt=\"Required PHP Version\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/12-laravel_version?style=for-the-badge\u0026color=ef9f76\u0026labelColor=302D41\u0026label=laravel\" alt=\"Required Laravel Version\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/MIT-license?style=for-the-badge\u0026color=cba6f7\u0026labelColor=302D41\u0026label=license\" alt=\"License\"\u003e\n\u003c/h4\u003e\n\n\u003cbr\u003e\n\n## 🚀 Introduction\n\n`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.\n\n**Laravel Tachyon** supports the following:\n\n- **Laravel Livewire**: Laravel Tachyon seamlessly integrates with Laravel Livewire, allowing you to optimize the HTML output of your Livewire components.\n\n- **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.\n\nAdditionally, **Laravel Tachyon** ensures that the optimization process does not break the following HTML elements:\n\n- `\u003cpre\u003e`: The content within `\u003cpre\u003e` tags, which is typically used for displaying preformatted text, is preserved and not modified during the optimization process.\n\n- `\u003ctextarea\u003e`: The content within `\u003ctextarea\u003e` tags, which is used for input fields that allow multiple lines of text, is also preserved and not modified.\n\n- `\u003cscript\u003e`: The content within `\u003cscript\u003e` 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.\n\n\u003cbr\u003e\n\n## 🏁 Getting Started\n\n### Requirements\n\n- **[PHP 8.2+](https://php.net/releases/)**\n- **[Laravel 12.0+](https://github.com/laravel/laravel)**\n  - But it should work for Laravel 11 as well.\n\n### Installation\n\nYou can install the package via composer:\n\n```zsh\ncomposer require dotninth/laravel-tachyon\n```\n\nThis package supports Laravel [Package Discovery][link-package-discovery].\n\n#### Publish configuration file\n\nTo customize the package settings, you can publish the configuration file with the following command:\n\n```zsh\nphp artisan vendor:publish --provider=\"DotNinth\\LaravelTachyon\\ServiceProvider\"\n```\n\n### Middleware Registration\n\nTo 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:\n\n```php\n// bootstrap/app.php\n\nreturn Application::configure(basePath: dirname(__DIR__))\n    ...\n    -\u003ewithMiddleware(function (Middleware $middleware) {\n        $middleware-\u003eappend([\n            \\DotNinth\\LaravelTachyon\\Middleware\\RemoveComments::class,\n            \\DotNinth\\LaravelTachyon\\Middleware\\CollapseWhitespace::class,\n            \\DotNinth\\LaravelTachyon\\Middleware\\ElideAttributes::class,\n            \\DotNinth\\LaravelTachyon\\Middleware\\InlineCss::class,\n            \\DotNinth\\LaravelTachyon\\Middleware\\InsertDNSPrefetch::class,\n            \\DotNinth\\LaravelTachyon\\Middleware\\DeferJavascript::class,\n        ]);\n    })\n    ...\n```\n\n\u003cbr\u003e\n\n## 🛠️ Middlewares Details\n\n- `RemoveComments::class`\n  - Removes HTML, JS, and CSS comments from the output to reduce the transfer size of HTML files.\n- `CollapseWhitespace::class`\n  - Reduces the size of HTML files by removing unnecessary white space.\n- `RemoveQuotes::class`\n  - Removes unnecessary quotes from HTML attributes, resulting in a reduced byte count on most pages.\n- `ElideAttributes::class`\n  - Reduces the transfer size of HTML files by removing attributes from tags if their values match the default attribute values.\n- `InsertDNSPrefetch::class`\n  - Includes `\u003clink rel=\"dns-prefetch\" href=\"//www.example.com\"\u003e` tags in the HTML `\u003chead\u003e` section to enable DNS prefetching, reducing DNS lookup time and improving page load times.\n- `TrimUrls::class`\n  - 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.\n- `InlineCss::class`\n  - Transforms the inline `style` attribute of HTML tags into classes by moving the CSS into the `\u003chead\u003e` section, improving page rendering and reducing the number of browser requests.\n- `DeferJavascript::class`\n  - Defers the execution of JavaScript code in HTML, prioritizing the rendering of critical content before executing JavaScript.\n    - If you need **to cancel the defer** in some script, use `data-tachyon-no-defer` as a script attribute to cancel the defer.\n\n\u003e [!WARNING]\n\u003e Use `TrimUrls::class` middleware with care, as it can cause problems if the wrong base URL is used.\n\n\u003e [!IMPORTANT]\n\u003e `CollapseWhitespace::class` automatically calls the `RemoveComments::class` middleware before executing.\n\n\u003e [!NOTE]\n\u003e You can **ignore** minification of some elements. Add `data-tachyon-ignore` as an element attribute to do so.\n\n\u003cbr\u003e\n\n## ⚙️ Configuration\n\nAfter installing the package, you may need to configure some options according to your needs.\n\n### Disable Service\n\nTo disable the Laravel Tachyon service in your local environment and get readable output, modify the following configuration file:\n\n```php\n// config/laravel-tachyon.php\n\n//Set this field to false to disable the Laravel Tachyon service.\n'enable' =\u003e env('LARAVEL_TACHYON_ENABLED', true),\n```\n\n### Skip routes\n\nYou can configure the package to skip optimization for certain routes. Use the `*` wildcard to match multiple routes. Here's an example:\n\n```php\n// config/laravel-tachyon.php\n\n//You can use * as wildcard.\n'skip' =\u003e [\n    '*.pdf', //Ignore all routes with final .pdf\n    '*/downloads/*',//Ignore all routes that contain 'downloads'\n    'assets/*', // Ignore all routes with the 'assets' prefix\n];\n```\n\nFeel free to adjust the configuration options according to your specific needs.\n\n\u003e _**Notice:**_ By default, the package automatically skips `binary` and `streamed` responses. See the [File Downloads][link-file-download] for more information.\n\n\u003cbr\u003e\n\n## 🧪 Testing\n\n```zsh\n$ composer test\n```\n\n\u003cbr\u003e\n\n## 🤝 Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n\u003cbr\u003e\n\n## 📄 License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[link-file-download]: https://laravel.com/docs/12.x/responses#file-downloads\n[link-package-discovery]: https://laravel.com/docs/12.x/packages#package-discovery\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotninth%2Flaravel-tachyon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotninth%2Flaravel-tachyon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotninth%2Flaravel-tachyon/lists"}