PHPackages                             preflow/blade - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. preflow/blade

ActiveLibrary[Templating &amp; Views](/categories/templating)

preflow/blade
=============

Preflow Blade adapter — Laravel Blade template engine implementation

v0.13.1(1mo ago)00MITPHPPHP &gt;=8.4

Since Apr 11Pushed 1mo agoCompare

[ Source](https://github.com/getpreflow/blade)[ Packagist](https://packagist.org/packages/preflow/blade)[ RSS](/packages/preflow-blade/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (19)Used By (0)

preflow/blade
=============

[](#preflowblade)

Laravel Blade adapter for Preflow. Implements `TemplateEngineInterface` using `illuminate/view`, with custom directives for asset collection and template functions.

Installation
------------

[](#installation)

```
composer require preflow/blade
```

Requires PHP 8.4+ and illuminate/view 11+.

What's included
---------------

[](#whats-included)

ComponentDescription`BladeEngine``TemplateEngineInterface` implementation wrapping Blade's `Factory` and `BladeCompiler``@css` / `@endcss`Directive pair for co-located CSS via `AssetCollector`Custom directivesTemplate functions registered via `addFunction()` become `@name(...)` directivesBladeEngine
-----------

[](#bladeengine)

```
use Preflow\Blade\BladeEngine;
use Preflow\View\AssetCollector;
use Preflow\View\NonceGenerator;

$assets = new AssetCollector(new NonceGenerator(), isProd: true);

$engine = new BladeEngine(
    templateDirs: [__DIR__ . '/templates', __DIR__ . '/app/pages'],
    assetCollector: $assets,
    debug: false,
    cachePath: __DIR__ . '/storage/blade-cache',  // null = system temp dir
);

$html = $engine->render('blog.post', ['post' => $post]);
$engine->exists('partials.nav');         // bool
$engine->getTemplateExtension();         // 'blade.php'
```

Templates
---------

[](#templates)

Blade templates use `.blade.php` extension with standard Blade syntax:

```
{{-- resources/views/blog/post.blade.php --}}

{{ $post->title }}
{!! $post->body !!}

@if($post->published)
  Published {{ $post->date }}
@endif

@foreach($comments as $comment)
  {{ $comment->text }}
@endforeach
```

Co-located styles
-----------------

[](#co-located-styles)

Use `@css` / `@endcss` to register CSS with the `AssetCollector`:

```
@css
.post-title { font-size: 2rem; font-weight: 700; }
.post-body  { line-height: 1.7; }
@endcss

{{ $post->title }}
{!! $post->body !!}
```

Layout with extends and sections
--------------------------------

[](#layout-with-extends-and-sections)

```
{{-- _layout.blade.php --}}

  @yield('title', 'App')

  @yield('content')

```

```
{{-- page.blade.php --}}
@extends('_layout')

@section('title', 'Blog')

@section('content')
  My Blog
@endsection
```

Custom function directives
--------------------------

[](#custom-function-directives)

Template functions registered via `addFunction()` become Blade directives. With `isSafe: true`, output is rendered raw; otherwise it is escaped via `e()`.

```
$engine->addFunction(new TemplateFunctionDefinition(
    name: 'component',
    callable: fn (string $name, array $props = []) => $renderer->render($name, $props),
    isSafe: true,
));
```

```
@component('Counter', ['count' => 0])
```

Global variables
----------------

[](#global-variables)

```
$engine->addGlobal('siteName', 'My App');
```

```
{{ $siteName }}
```

Engine configuration
--------------------

[](#engine-configuration)

Set `APP_ENGINE=blade` in your `.env` to use Blade. Preflow's `Application` will automatically create a `BladeEngine` and register all extension providers.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance88

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

18

Last Release

59d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d8b54efbc79683c32645e3fa8d3590037fa003963a16e0ed989104c6f4a2723?d=identicon)[smyr](/maintainers/smyr)

---

Top Contributors

[![smeyerme](https://avatars.githubusercontent.com/u/1925560?v=4)](https://github.com/smeyerme "smeyerme (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/preflow-blade/health.svg)

```
[![Health](https://phpackages.com/badges/preflow-blade/health.svg)](https://phpackages.com/packages/preflow-blade)
```

###  Alternatives

[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[moonshine/moonshine

Laravel administration panel

1.3k239.9k72](/packages/moonshine-moonshine)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9732.3M121](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[illuminate/view

The Illuminate View package.

13046.3M2.1k](/packages/illuminate-view)[blade-ui-kit/blade-icons

A package to easily make use of icons in your Laravel Blade views.

2.5k39.5M381](/packages/blade-ui-kit-blade-icons)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
