PHPackages                             te-cho/compile-blades - 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. te-cho/compile-blades

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

te-cho/compile-blades
=====================

A Laravel package for compiling blades nested in 1 file into 1 flattened file.

v1.0(8y ago)631.8k23[7 issues](https://github.com/Te-cho/compile-blades/issues)[1 PRs](https://github.com/Te-cho/compile-blades/pulls)MITPHPPHP &gt;=5.5.9CI failing

Since Jul 1Pushed 6y ago4 watchersCompare

[ Source](https://github.com/Te-cho/compile-blades)[ Packagist](https://packagist.org/packages/te-cho/compile-blades)[ RSS](/packages/te-cho-compile-blades/feed)WikiDiscussions develop Synced 2w ago

READMEChangelog (4)Dependencies (7)Versions (6)Used By (0)

compile-blades
==============

[](#compile-blades)

A Laravel package for compiling blades nested in 1 file into 1 flattened file.

Why?
----

[](#why)

> For best performance, you may want to consider flattening your blades on production, cause a lot of nesting consumes time in laravel since each nested level repeats the same pipline process, that consumes time &amp; memory.

Example of problems:

-
-

**Table of Contents**

- [Installation](#installation)
    - [1) Require the package](#2-require-the-package)
    - [2) Configure Laravel](#3-configure-laravel)
- [Usage](#usage)
    - [Generating flatened blade file](#generating-flattened-blade)
- [A demo](#a-demo)
    - [Perfomance Insights results](#profiler-resutls)

### 1) Require the package

[](#1-require-the-package)

Next, you'll need to require the package using Composer:

From your project's base path, run:

```
$ composer require te-cho/compile-blades

```

### 2) Configure Laravel

[](#2-configure-laravel)

#### Service Provider

[](#service-provider)

Add the following to the `providers` key in `config/app.php`:

```
'providers' => [
    Techo\CompileBlades\CompileBladesServiceProvider::class,
];
```

#### Console

[](#console)

To get access to the `compile:blades` command, add the following to the `$commands` property in `app/Console/Kernel.php`:

```
protected $commands = [
    \Techo\CompileBlades\Console\CompileBlades::class,
];
```

Usage
-----

[](#usage)

Before getting started, I highly recommend reading through Laravels documentation on Views and Blades.

### Flattening Views:

[](#flattening-views)

Providing everything is set up and configured properly, all you need to do in order to flatten a view for a certain route or something else, is running the following command:

```
$ php artisan compile:blades view-name

```

This will generate a flattened view instead of the current one.

Example:
--------

[](#example)

Lets say we have a view called test.blade.php that is called by one of our controllers, which is including another view inside of it, but the problem is that its looping in it, which causes the include to happen alot which cause performance drops. So we run the following command:

```
$ php artisan compile:blades test

```

### Input File

[](#input-file)

[![test.blade.php](https://camo.githubusercontent.com/2dac3ed7607b8e7656488fbc823ae0097c0704be4c8a5e654b815bd217a969a9/68747470733a2f2f676f6f2e676c2f68774e534363)](https://camo.githubusercontent.com/2dac3ed7607b8e7656488fbc823ae0097c0704be4c8a5e654b815bd217a969a9/68747470733a2f2f676f6f2e676c2f68774e534363)[![subviews/included-test.blade.php](https://camo.githubusercontent.com/aa2968a61398958e5f0d63fd1eea4001d067ad049b5e86c1574db4ac1d4220b2/68747470733a2f2f676f6f2e676c2f6a6b6f736548)](https://camo.githubusercontent.com/aa2968a61398958e5f0d63fd1eea4001d067ad049b5e86c1574db4ac1d4220b2/68747470733a2f2f676f6f2e676c2f6a6b6f736548)

### Output File

[](#output-file)

[![test.blade.php](https://camo.githubusercontent.com/f7936489795b9cd1e9607b6a266420cd885ca8fec58115946950d4b97d2acd28/68747470733a2f2f676f6f2e676c2f5047526b4a6b)](https://camo.githubusercontent.com/f7936489795b9cd1e9607b6a266420cd885ca8fec58115946950d4b97d2acd28/68747470733a2f2f676f6f2e676c2f5047526b4a6b)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% 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 ~0 days

Total

3

Last Release

3250d ago

Major Versions

v0.9-beta → v1.02017-08-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/184bd41d19f6fd6e7dcb7484eb1682481d8f86e07273925bb6df70eb856f3249?d=identicon)[abd\_rmdn](/maintainers/abd_rmdn)

---

Top Contributors

[![abidulrmdn](https://avatars.githubusercontent.com/u/3129531?v=4)](https://github.com/abidulrmdn "abidulrmdn (26 commits)")[![anirbanwgt](https://avatars.githubusercontent.com/u/27990927?v=4)](https://github.com/anirbanwgt "anirbanwgt (1 commits)")

---

Tags

bladeblade-templatecompilefastflattenlaravelperformanceviewslaravelperformanceviewscompileflattenblades

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/te-cho-compile-blades/health.svg)

```
[![Health](https://phpackages.com/badges/te-cho-compile-blades/health.svg)](https://phpackages.com/packages/te-cho-compile-blades)
```

###  Alternatives

[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M154](/packages/spatie-laravel-health)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M282](/packages/laravel-horizon)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.3k449.3k30](/packages/tightenco-jigsaw)

PHPackages © 2026

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