VeldoraDocs

4. Blade-Inspired Templates

Veldora templates end with .veldora.php and live in resources/views/. They provide clean syntax and compile to pure PHP without runtime overhead.

Outputting Variables

template.veldora.php
HTML
<!-- Escaped output (prevents XSS) -->
<h1>&#123;&#123; $post->title &#125;&#125;</h1>

<!-- Raw unescaped HTML -->
<div>{!! $post->content_html !!}</div>

Control Directives

template.veldora.php
HTML
<!-- Conditionals -->
&#64;if($user->isAdmin())
    <span class="badge">Admin</span>
&#64;elseif($user->isEditor())
    <span class="badge">Editor</span>
&#64;else
    <span>Member</span>
&#64;endif

<!-- Loops -->
&#64;foreach($posts as $post)
    <div class="card">
        <h3>&#123;&#123; $post->title &#125;&#125;</h3>
    </div>
&#64;endforeach

<!-- Forelse with fallback -->
&#64;forelse($comments as $comment)
    <p>&#123;&#123; $comment->body &#125;&#125;</p>
&#64;empty
    <p>No comments yet.</p>
&#64;endforelse

<!-- Auth state checks -->
&#64;auth
    <a href="/dashboard">Dashboard</a>
    <a href="/logout">Logout</a>
&#64;endauth

&#64;guest
    <a href="/login">Login</a>
    <a href="/register">Register</a>
&#64;endguest

Layout Inheritance & Yields

Create a parent layout in resources/views/layouts/app.veldora.php:

template.veldora.php
HTML
<!DOCTYPE html>
<html>
<head>
    <title>&#64;yield('title', 'My Application')</title>
</head>
<body>
    <header>
        <nav><!-- navigation links --></nav>
    </header>

    <main>
        &#64;yield('content')
    </main>

    <footer>&copy; &#123;&#123; date('Y') &#125;&#125; Veldora</footer>
</body>
</html>

Extend it in your page views:

template.veldora.php
HTML
&#64;extends('layouts.app')

&#64;section('title', 'Blog Posts')

&#64;section('content')
    <h1>All Posts</h1>
    <!-- Page content here -->
&#64;endsection

Reusable UI Components

Use the <x-component-name> syntax to render reusable components:

template.veldora.php
HTML
<x-button variant="primary" size="lg">Save Changes</x-button>

<x-card title="Account Settings">
    <x-input name="username" label="Username" value="&#123;&#123; $user->name &#125;&#125;" />
</x-card>


Building with AI Assistants?
Copy the Veldora AI Developer Prompt to teach ChatGPT, Claude, Cursor, or Gemini all framework APIs for error-free coding.