Framework Features

PhpTemplate Engine

Modern Blade-like templating with powerful directives:

Variables

<!-- Escaped output (safe from XSS) -->
{{ $user->name }}
{{ $post->title }}

<!-- Unescaped output (raw HTML) -->
{!! $htmlContent !!}

<!-- With null coalescing -->
{{ $user->name ?? 'Guest' }}

Conditionals

@if($user->isAdmin())
    <p>You are an admin</p>
@elseif($user->isModerator())
    <p>You are a moderator</p>
@else
    <p>You are a regular user</p>
@endif

Loops

@foreach($posts as $post)
    <div class="post">
        <h3>{{ $post->title }}</h3>
        <p>{{ $post->content }}</p>
    </div>
@endforeach

@forelse($users as $user)
    <li>{{ $user->name }}</li>
@empty
    <li>No users found</li>
@endforelse

Components

<!-- Using a component -->
<x-layout-app title="Page Title">
    <h1>Welcome</h1>
    <p>This is the content</p>
</x-layout-app>

<!-- Self-closing component -->
<x-alert type="success" message="Operation successful!" />

Authentication

Built-in authentication helpers:

// Check if user is logged in
if (is_logged_in()) {
    // User is authenticated
}

// Check if user is admin
if (is_admin()) {
    // User has admin privileges
}

// Get current user
$user = current_user();
echo $user->name;

CSRF Protection

Secure your forms automatically:

<form action="/products" method="POST">
    @php echo csrf_field(); @endphp

    <input type="text" name="name" required>
    <button type="submit">Submit</button>
</form>

// In controller
if (!csrf_verify()) {
    Session::setflash('Invalid security token.', 'danger');
    redirect('/products/create');
    return;
}