PHPackages                             vhraban/blade-string-renderer - 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. vhraban/blade-string-renderer

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

vhraban/blade-string-renderer
=============================

03101[3 issues](https://github.com/vhraban/Blade-string-renderer/issues)PHP

Since Aug 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/vhraban/Blade-string-renderer)[ Packagist](https://packagist.org/packages/vhraban/blade-string-renderer)[ RSS](/packages/vhraban-blade-string-renderer/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Blade-string-renderer
=====================

[](#blade-string-renderer)

Blade templating engine is effective and easy to use, but lacks flexibility. It is impossible with blade to render a template from string. The idea behing the way it was engineered is that every template has to be a physical file on a file system, and if the template is coming from DB database or wherever else, then there is pretty much nothing non-hacky that can be done.

How it works
------------

[](#how-it-works)

This works quite simply. Blade-string-renderer extends Laravel's View Factory and can be used in exacly the same way as standard view. The main difference is that it has an additional method that makes a view from temlate string as opposed to template file.

Blade-string-renderer is totally unintrusive. Instead of fiddling with Blade/Laravel's View Factory internals, the library provides the easiest and probably future-proof way of handling this case. Just before the view is rendered, the template contents (passed as a string) get saved to a temporary directory on a local filesystem. The renderer then proceeds to work as usual by using blade template stored in a temporary location. After the template is rendered, temporary file is deleted. This approach, while being primitive, makes sure that Laravel View Factory and Blade internals are tweaked as little as possible, providing robust and loose solution for such a common problem

Usage
-----

[](#usage)

```
/**
 * @param BladeStringRenderer\BladeStringFactory $viewFactory
 */
public function __construct(BladeStringRenderer\BladeStringFactory $viewFactory)
{
    $this->viewFactory = $viewFactory;
}

/**
 * Render the template from the template string
 *
 * @param string $templateString
 * @param array $data
 *
 * @return string rendered template
 */
protected function buildFromTemplateString(string $templateString, array $data)
{
    return $this->viewFactory->makeFromTemplateString($templateString, $data)->render();
}
```

There are no tests as of yet
----------------------------

[](#there-are-no-tests-as-of-yet)

They are coming soon. Blade-string-renderer was needed urgently, and it is not yet tested.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

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://avatars.githubusercontent.com/u/137852?v=4)[Hraban](/maintainers/hraban)[@hraban](https://github.com/hraban)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/vhraban-blade-string-renderer/health.svg)

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

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