Quick lookup for Crema syntax. For explanations and full examples, follow the “Guide” links.
| Directive |
Closer / notes |
Guide |
@extends('layout') |
Child declares parent layout |
Layouts |
@section('name', 'text') |
Inline section |
Layouts |
@section('name') |
Block section |
@endsection or @show |
@endsection |
End block section (store raw) |
Layouts |
@show |
End section and expand immediately |
Layouts |
@yield('name') |
Print section |
Optional default: @yield('n', 'default') |
@parent |
Insert parent section buffer |
Inside a child @section |
@hasSection('name') |
Body if section defined |
Closes with @endif |
@sectionMissing('name') |
Body if section missing |
Closes with @endif |
| Directive |
Closer |
Guide |
@push('name') |
@endpush |
Stacks |
@prepend('name') |
@endprepend |
Stacks |
@stack('name') |
— |
Stacks |
| Directive |
Notes |
Guide |
@include('name') |
Required; throws if missing |
Includes |
@includeIf('name') |
Skip if missing |
Includes |
@includeWhen(expr, 'name') |
When truthy |
Includes |
@includeUnless(expr, 'name') |
When not truthy |
Includes |
@includeFirst(['a', 'b']) |
First resolvable name |
Includes |
@once |
@endonce — once per render |
Includes |
@verbatim |
@endverbatim — no processing |
Includes |
index, iteration, first, last, count, remaining, even, odd, depth, parent — see Loop metadata.
| Syntax |
Purpose |
Guide |
@component('name')…@endcomponent |
Render a view as a component |
Components |
@slot('name')…@endslot |
Named slot inside @component |
Components |
<x-name>…</x-name> |
Render components.name |
Components |
<x-name /> |
Empty default slot |
Components |
<x-slot name="n">…</x-slot> |
Named slot for <x-*> or prefixed tags |
Components |
<x-slot:n>…</x-slot:n> |
Colon-name form |
Components |
<prefix:slot name="n">… |
Named slot for extension tags |
Components |
Inside the component view: {{ slot }} (default) and {{ name }} for each named slot.
| Directive |
Purpose |
Guide |
@csrf |
Hidden _token input |
Forms |
@method('VERB') |
Hidden _method input |
Forms |
@error('field') |
@enderror when errors has field |
Forms |
@asset('path') |
Public asset URL |
Rendering |
@json($expr) |
JSON encode |
Rendering |
@lang('key') |
Translation |
Optional replace map |
@vite('entry') |
Script/link tags under /build |
List form supported |
Apps and packages can register more syntax on CremaEngine:
| API |
Shape |
directive(name) { … } |
@name / @name(args) |
blockDirective(name) { … } |
@name…@endname |
tag(prefix) { … } |
<prefix:name>… |
Brew uses these for @brew and <brew:…>. See Brew (full guides on the Brew docs site).