Polyscope - The agent-first dev environment for Laravel

Blade

jenssegers/blade image

Blade stats

Downloads
541.7K
Stars
731
Open Issues
26
Forks
112

View on GitHub →

The standalone version of Laravel's Blade templating engine for use outside of Laravel.

Blade

The standalone version of Laravel's Blade templating engine for use outside of Laravel.

Installation

Install using composer:

composer require jenssegers/blade

Usage

Create a Blade instance by passing it the folder(s) where your view files are located, and a cache folder. Render a template by calling the make method. More information about the Blade templating engine can be found on http://laravel.com/docs/5.8/blade.

use Jenssegers\Blade\Blade;
 
$blade = new Blade('views', 'cache');
 
echo $blade->make('homepage', ['name' => 'John Doe'])->render();

Alternatively you can use the shorthand method render:

echo $blade->render('homepage', ['name' => 'John Doe']);

You can also extend Blade using the directive() function:

$blade->directive('datetime', function ($expression) {
return "<?php echo with({$expression})->format('F d, Y g:i a'); ?>";
});

Which allows you to use the following in your blade template:

Current date: @datetime($date)

The Blade instances passes all methods to the internal view factory. So methods such as exists, file, share, composer and creator are available as well. Check out the original documentation for more information.

Integrations

jenssegers photo

Engineering Manager & Solution Architect at OTA Insight

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Jenssegers Blade Related Articles

Simple Feature Flags for Laravel with Laravel Toggle image

Simple Feature Flags for Laravel with Laravel Toggle

Read article
Drag-and-Drop Sorting for Eloquent Models with Reorderable for Laravel image

Drag-and-Drop Sorting for Eloquent Models with Reorderable for Laravel

Read article
Ship AI with Laravel: Real-Time Streaming Chat UI with Livewire image

Ship AI with Laravel: Real-Time Streaming Chat UI with Livewire

Read article
Generate HTML Password Rules Attribute in Laravel 13.9.0 image

Generate HTML Password Rules Attribute in Laravel 13.9.0

Read article
Generate Livewire Skeleton Placeholders Automatically with Wirebones image

Generate Livewire Skeleton Placeholders Automatically with Wirebones

Read article
Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel image

Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel

Read article
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud