PHPackages                             adamgaskins/view-string - 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. adamgaskins/view-string

Abandoned → Laravel 9's Blade::render()ArchivedLibrary[Templating &amp; Views](/categories/templating)

adamgaskins/view-string
=======================

The view() helper's little brother; a function to compile blade views from strings.

v1.3.0(4y ago)43.0k↓77.8%MITPHPPHP ^7.4|^8.0

Since Jan 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/AdamGaskins/view-string)[ Packagist](https://packagist.org/packages/adamgaskins/view-string)[ Docs](https://github.com/adamgaskins/view-string)[ RSS](/packages/adamgaskins-view-string/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (5)Dependencies (3)Versions (7)Used By (0)

**Notice: This package is obsolete as of Laravel 9, which [includes this feature](https://laravel.com/docs/9.x/releases#rendering-inline-blade-templates) as part of the framework. `view-string` has been updated to work with Laravel 9, but migrating to use `Blade::render()` is extremely easy, so `view-string` will not be updated to keep up with future Laravel releases.**

**You are welcome to continue using, or to copy the class into your code if the "abandoned" packagist status annoys you.**

[![](assets/screenshot.png)](https://github.com/AdamGaskins/view-string)

The `view()` helper's little brother; a function to compile blade views from strings.

 [![](https://camo.githubusercontent.com/6a5661f97f1ba1a27059eb515f1477848e77a033d455142487a3ca410cc93e88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6164616d6761736b696e732f766965772d737472696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/adamgaskins/view-string) [![](https://camo.githubusercontent.com/c492d9331f13aeacede36927bbae5d807427fe5a1032091060add750cbbdb970/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6164616d6761736b696e732f766965772d737472696e672f54657374733f6c6f676f3d476974687562267374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/adamgaskins/view-string/actions?query=workflow%3ATests+branch%3Amaster)

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

[](#installation)

You can install the package via composer:

```
composer require adamgaskins/view-string
```

Usage
-----

[](#usage)

This package allows you to compile a blade template dynamically from a string instead of it being hardcoded in the `resources/views` folder of your site. Usually this will look like a trusted user (developer/admin) using an embedded [editor](https://microsoft.github.io/monaco-editor/) to write a blade template which is then saved to the database. You can then easily render the template like so:

```
$design = Design::find(1);

view_string($design->content, [ 'blogPost' => $post ]);
```

Or if you want to include it in your blade templates, there's a directive for that:

```
@includeString($design->content [ 'blogPost' => $post ])
```

Use `view_string` where you'd use `view`, and `@includeString` where you'd use `@include`.

eval
----

[](#eval)

This package uses eval behind the scenes. It is not sandboxed. The goal of this package is to allow developers to write small blade snippets without needing to deploy. I am not responsible for what happens if you let random strangers on the internet run code on your servers.

We use this package at my company to allow us to quickly write tiny snippets of custom elements for our customers, saving us the need to do a full site deploy every time a user requests a change.

Testing
-------

[](#testing)

```
composer test
```

Related
-------

[](#related)

- [`wpb/string-blade-compiler`](https://github.com/TerrePorter/StringBladeCompiler): A great package that I used for years, and inspired this package. A little bit more opinionated though, the fact that it completely replaces `Illuminate\View\View` leads to [issues](https://github.com/TerrePorter/StringBladeCompiler/issues/73) in some random edge cases.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 96% 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.

###  Release Activity

Cadence

Every ~115 days

Total

5

Last Release

1512d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/63884672ecd65deace8ca6f9247e039c8d1149c46d1b81e840d201313e032252?d=identicon)[AdamGaskins](/maintainers/AdamGaskins)

---

Top Contributors

[![AdamGaskins](https://avatars.githubusercontent.com/u/1180782?v=4)](https://github.com/AdamGaskins "AdamGaskins (24 commits)")[![danielzzz](https://avatars.githubusercontent.com/u/351916?v=4)](https://github.com/danielzzz "danielzzz (1 commits)")

---

Tags

bladelaravellaravel-packagelaravelbladeview

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adamgaskins-view-string/health.svg)

```
[![Health](https://phpackages.com/badges/adamgaskins-view-string/health.svg)](https://phpackages.com/packages/adamgaskins-view-string)
```

###  Alternatives

[leitsch/kirby-blade

Enable Laravel Blade Template Engine for Kirby 4 and Kirby 5

2110.1k](/packages/leitsch-kirby-blade)[djl997/blade-shortcuts

Blade Shortcuts is a library of handy Laravel Blade Directives.

411.0k3](/packages/djl997-blade-shortcuts)[johnturingan/laravel-fly-view

Render Blade templates from string mark-up.

163.9k](/packages/johnturingan-laravel-fly-view)

PHPackages © 2026

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