You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-6Lines changed: 31 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,15 @@ Blaze supercharges your Blade components by compiling them into direct PHP funct
13
13
14
14
Blaze is designed as a drop-in replacement for anonymous Blade components. It supports all essential features including props, slots, attributes, and `@aware`. The HTML output is identical to standard Blade rendering.
15
15
16
-
> [!IMPORTANT]
17
-
> When using `@aware`, both the parent and child components must use Blaze for values to propagate correctly.
16
+
### Limitations
17
+
18
+
Blaze focuses on anonymous components. The following are not supported:
19
+
20
+
- Class-based components
21
+
- The `$component` variable
22
+
-`View::share()` variables
23
+
- View composers / creators
24
+
- Component lifecycle events
18
25
19
26
## Installation
20
27
@@ -46,9 +53,6 @@ This optimizes all [anonymous component paths](https://laravel.com/docs/12.x/bla
46
53
php artisan view:clear
47
54
```
48
55
49
-
> [!NOTE]
50
-
> Blaze focuses on anonymous components. Class-based components, the `$component` variable, `View::share()` variables, view composers, and component lifecycle events are not supported.
51
-
52
56
## Configuration
53
57
54
58
### Directory-Based Optimization
@@ -91,6 +95,13 @@ Optimization strategies can be specified directly:
Blaze fully supports the `@aware` directive for sharing data between parent and child components.
101
+
102
+
> [!IMPORTANT]
103
+
> When using `@aware`, both the parent and child components must use Blaze for values to propagate correctly.
104
+
94
105
## Optimization Strategies
95
106
96
107
Blaze offers three optimization strategies, each suited to different use cases:
@@ -178,11 +189,25 @@ If `<x-icon name="check" />` appears 50 times on a page, it renders once and reu
178
189
179
190
### Compile-Time Folding
180
191
181
-
Compile-time folding is Blaze's most aggressive optimization. It pre-renders components during compilation, embedding the HTML directly into your template. The component no longer exists at runtime.
192
+
Compile-time folding is Blaze's most aggressive optimization. It pre-renders components during compilation, embedding the HTML directly into your template. The component ceases to exist at runtime - there is no function call, no variable resolution, no overhead whatsoever.
193
+
194
+
#### Benchmark Results
195
+
196
+
Because folded components are rendered at compile-time, the runtime cost is effectively zero. The rendering time remains constant regardless of how many components you use:
197
+
198
+
| Components | Blade | Blaze (folded) |
199
+
|------------|-------|----------------|
200
+
| 25,000 | 500ms | 0.68ms |
201
+
| 50,000 | 1,000ms | 0.68ms |
202
+
| 100,000 | 2,000ms | 0.68ms |
203
+
204
+
The time doesn't grow because there are no components to render - just static HTML.
182
205
183
206
> [!CAUTION]
184
207
> Folding requires careful consideration. Used incorrectly, it can cause subtle bugs that are difficult to diagnose. Review the [Folding](#folding) section before enabling.
0 commit comments