Performance: Blade directives
MEDIUM IMPACT
Blade directives affect server-side rendering speed and the size of the generated HTML, impacting initial page load time.
@if($user->isAdmin()) <div>Admin Panel</div> @endif
@php if($user->isAdmin()) { echo '<div>Admin Panel</div>'; } @endphp
| Pattern | Server CPU Cost | HTML Size | Network Impact | Verdict |
|---|---|---|---|---|
| Raw PHP in Blade | High | Potentially Large | Slower Transfer | [X] Bad |
| Proper Blade directives | Low | Minimal | Faster Transfer | [OK] Good |
| Large loops without limits | High | Very Large | Slow Transfer | [X] Bad |
| Limited loops with pagination | Low | Small | Fast Transfer | [OK] Good |