PHPackages                             quellabs/canvas-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. quellabs/canvas-blade

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

quellabs/canvas-blade
=====================

Blade template engine integration for the Canvas PHP framework

1.0.8(3w ago)00MITPHP

Since Mar 10Pushed 3w agoCompare

[ Source](https://github.com/quellabs/canvas-blade)[ Packagist](https://packagist.org/packages/quellabs/canvas-blade)[ Docs](https://github.com/quellabs/canvas-blade)[ RSS](/packages/quellabs-canvas-blade/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (24)Versions (10)Used By (0)

Blade Template Engine for Canvas Framework
==========================================

[](#blade-template-engine-for-canvas-framework)

A Blade template engine implementation for the Canvas PHP framework that provides a consistent interface for template rendering operations.

Features
--------

[](#features)

- **Interface Compliance**: Implements `TemplateEngineInterface` for consistent template engine operations
- **Flexible Configuration**: Supports all major Blade configuration options
- **Caching Support**: Built-in template caching with cache management
- **Global Variables**: Support for framework-wide template variables
- **Custom Directives**: Easy registration of custom directives and @if-directives
- **String Templates**: Render templates from strings as well as files
- **Multiple Template Paths**: Support for namespaced template directories

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

[](#installation)

Install the package via Composer:

```
composer require quellabs/canvas-blade
```

The package includes Blade as a dependency and automatically copies the configuration file to `/config/blade.php`. No additional setup is required - just register the service provider in your Canvas framework configuration.

Configuration
-------------

[](#configuration)

The package automatically creates a configuration file at `config/blade.php` during installation.

Selecting the Default Template Engine
-------------------------------------

[](#selecting-the-default-template-engine)

To use Blade as the default template engine across your application, set the following in `config/app.php`:

```
'template_engine' => 'blade',
```

Once set, rendering templates in your controllers works as normal:

```
/**
 * @Route("/")
 * @return Response
 */
public function index(Request $request): Response {
    return $this->render('pages.home', [
        'title' => 'Welcome',
    ]);
}
```

If you need to mix multiple template engines in the same project, you can request a specific engine explicitly via the container:

```
$template = $container->for('blade')->get(TemplateEngineInterface::class);
$template = $container->for('twig')->get(TemplateEngineInterface::class);
```

Error Handling
--------------

[](#error-handling)

The template engine provides detailed error messages for common issues:

```
try {
    $output = $template->render('nonexistent', $data);
} catch (TemplateRenderException $e) {
    echo "Template error: " . $e->getMessage();
}
```

Custom Directives
-----------------

[](#custom-directives)

Register custom directives in `config/blade.php` or at runtime:

```
// In config/blade.php
'directives' => [
    'datetime' => fn($expr) => '',
],

// At runtime
$template->registerDirective('datetime', fn($expr) => '');
```

Use in templates:

```
@datetime($created_at)
```

### @if Directives

[](#if-directives)

Register custom condition directives:

```
'if_directives' => [
    'admin' => fn() => currentUser()->isAdmin(),
],
```

Use in templates:

```
@admin
    Admin panel
@endadmin
```

Performance Considerations
--------------------------

[](#performance-considerations)

1. **Enable Caching**: Always enable caching in production environments
2. **Template Compilation**: Blade compiles templates to PHP for better performance
3. **Cache Warming**: Consider pre-compiling templates for optimal performance

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Canvas Framework with TemplateEngineInterface

License
-------

[](#license)

MIT License

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Add tests for new functionality
4. Submit a pull request

Support
-------

[](#support)

For issues specific to this Blade implementation, please check:

1. Blade documentation:
2. Canvas framework documentation
3. This implementation's source code comments

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance95

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

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 ~10 days

Total

9

Last Release

23d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57e4ab872b3e37536367f2d26b192df3d3bb6a6a1cebec9a104d14a6d2ffe157?d=identicon)[noescom](/maintainers/noescom)

---

Tags

blade templatecanvas-frameworktemplate-integrationphp-templating

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[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)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[illuminate/view

The Illuminate View package.

13046.3M2.1k](/packages/illuminate-view)[moonshine/moonshine

Laravel administration panel

1.3k239.9k75](/packages/moonshine-moonshine)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.3k449.3k30](/packages/tightenco-jigsaw)

PHPackages © 2026

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