PHPackages                             sngrl/string-blade-compiler - 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. sngrl/string-blade-compiler

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

sngrl/string-blade-compiler
===========================

Render Blade templates from string variable

823.9k—0%2[2 PRs](https://github.com/sngrl/string-blade-compiler/pulls)PHP

Since Oct 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sngrl/string-blade-compiler)[ Packagist](https://packagist.org/packages/sngrl/string-blade-compiler)[ RSS](/packages/sngrl-string-blade-compiler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

String Blade Compiler
=====================

[](#string-blade-compiler)

Blade is a extremly simple, yet powerful templating engine provided with Laravel. Unfortunately, the "out of the box," he can only work with files on the hard drive, while it may be necessary to compile template of the string variable. This package allow for a generic array of the required fields to generates and return a compiled view from a blade-syntax template.

This repository is a fork of the  which in turn was formed from  which uses Eloquent model to pass in a template.

Author of the original laravel-db-blade-compiler - Flyn San () Author of the StringBladeCompiler - Terre Porter ()

This package was created to import to the site packagist.org and allow installation through Composer ().

Installation
============

[](#installation)

Require this package in your composer.json and run in your console composer update command:

```
	"require": {
        /*** Some others packages ***/
		"sngrl/string-blade-compiler": "dev-master",
	},
```

Or just run this in console:

```
composer require sngrl/string-blade-compiler:dev-master
```

After updating composer, add the ServiceProvider to the "providers" array in app/config/app.php:

```
	'providers' => array(
        /*** Some others providers ***/
        'sngrl\StringBladeCompiler\StringBladeCompilerServiceProvider',
    ),
```

There is no need to add a Facade to the aliases array in the same file as the service provider, this is being included automatically in the ServiceProvider.

Usage
=====

[](#usage)

This package offers a StringView facade with the same syntax as View but accepts a Array or Array Object instance instead of path to view.

```
return StringView::make(
                array(
                    // this actual blade template
                    'template'  => '{{ $token1 }}',
                    // this is the cache file key, converted to md5
                    'cache_key' => 'my_unique_cache_key',
                    // timestamp for when the template was last updated, 0 is always recompile
                    'updated_at' => 1391973007
                ),
                array(
                    'token1'=> 'token 1 value'
                )
        );
```

Force compile method:

```
return StringView::force('{{ $token1 }}', array('token1'=> 'token 1 value'));
```

License
=======

[](#license)

string-blade-compiler is open-sourced software licensed under the MIT license

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a53ab327dd96f1748aa6515bb30015958e7275ef10daf14bee13522572ff048b?d=identicon)[sngrl](/maintainers/sngrl)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/sngrl-string-blade-compiler/health.svg)

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

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

555.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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