antonchaikin/f3-blade

Fat-Free Framework plugin for Blade template rendering

v1.0.0 2025-05-28 14:56 UTC

This package is auto-updated.

Last update: 2025-05-28 14:59:33 UTC


README

Fat-Free Framework plugin for Blade template rendering.

This plugin integrates Jenssegers Blade into the Fat-Free Framework (F3), allowing you to use $f3->blade() to render Blade views.

💡 Installation

Install via Composer:

composer require antonchaikin/f3-blade

🚀 Usage

In your index.php:

use F3Blade\BladePlugin;

BladePlugin::setPaths(__DIR__ . '/resources/views', __DIR__ . '/resources/cache');
BladePlugin::addNamespace('app', __DIR__ . '/resources/custom');
BladePlugin::register();

$f3->blade('home', ['title' => 'Hello']);

This will render resources/views/home.blade.php.

✨ Features

  • Adds $f3->blade() helper to render views using Blade
  • Supports setting custom view and cache paths
  • Supports adding view namespaces via addNamespace()

🧠 IDE Autocomplete

To enable autocomplete in IDEs (e.g. VS Code), use:

/** @var \Base&\F3Blade\BladeAwareF3 $f3 */

And define this interface:

namespace F3Blade;

/**
 * @method string blade(string $view, array $data = [], array $mergeData = [])
 */
interface BladeAwareF3 {}

📁 File Structure

resources/
├── views/
│   └── home.blade.php
└── cache/

📝 License

MIT License © 2025 Anton Chaikin