flynsarmy/db-blade-compiler
Larablocks Analysis
flynsarmy/db-blade-compiler works with any PHP project: the latest release (v9.0.2, Feb 5, 2024) doesn't depend on Laravel.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Feb 5, 2024)
- 7,913 downloads a month (needs 10,000)
- 168 GitHub stars (at least 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Feb 5, 2024.
- No releases in the last 12 months.
- First released: Dec 28, 2013.
- Monthly downloads: 7,913, up 27% from six months ago.
- 8 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.
| Install | |
|---|---|
composer require flynsarmy/db-blade-compiler |
|
| Latest Version: | v9.0.2 |
| PHP: | >=7.1 |
| License: | MIT |
| Last Updated: | Feb 5, 2024 |
| Links: | GitHub · Packagist |
DB Blade Compiler
Render Blade templates from Eloquent Model Fields
This package generates and returns a compiled view from a blade-syntax field in your Eloquent model.
Installation (Laravel v < 5)
Require this package in your composer.json and run composer update (or run composer require flynsarmy/db-blade-compiler:1.* directly):
"flynsarmy/db-blade-compiler": "1.*"
After updating composer, add the ServiceProvider to the providers array in app/config/app.php
'Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider',
and the Facade to the aliases array in the same file
'DbView' => 'Flynsarmy\DbBladeCompiler\Facades\DbView',
You can also optionally publish the config-file
php artisan config:publish flynsarmy/db-blade-compiler
Installation (Laravel 5.x)
Require this package in your composer.json and run composer update (or run composer require flynsarmy/db-blade-compiler:2.* directly):
"flynsarmy/db-blade-compiler": "*"
The DbBladeCompilerServiceProvider is auto-discovered and registered by default, but if you want to register it yourself:
add the ServiceProvider to the providers array in app/config/app.php
'Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider',
and the DbView facade is also auto-discovered, but if you want to add it manually:
add the Facade to the aliases array in config/app.php
'DbView' => 'Flynsarmy\DbBladeCompiler\Facades\DbView',
You have to also publish the config-file
php artisan vendor:publish --provider="Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider"
Usage
This package offers a DbView facade with the same syntax as View but accepts a Model instance instead of path to view.
$template = Template::first();
return DbView::make($template)->with(['foo' => 'Bar'])->render();
Because you're passing a model to DbView::make(), db-blade-compiler needs to know which field to compile. By default this is content however you can set the field used with either of the following methods:
return DbView::make($template, ['foo' => 'Bar'], [], 'excerpt')->render();
return DbView::make($template)->field('excerpt')->with(['foo' => 'Bar'])->render();
You may set the default column used in the package config. You can enable using cache in compiling view from a blade-syntax field in your Eloquent model operation by enabling cache config in package config. By default this option is disabled.
License
db-blade-compiler is open-sourced software licensed under the MIT license
Related Packages
An Laravel eloquent-like model class, for Laravel and other frameworks
Laravel Blade String Compiler, render string as blade templates
Inspect Laravel Eloquent models to collect properties, relationships and more.
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| v9.0.2 | >=7.1 | MIT | |
| v9.0.1 | >=7.1 | MIT | |
| v9.0.0 | >=7.1 | MIT | |
| 5.5.0 | >=5.3.0 | MIT | |
| 5.4.4 | >=5.3.0 | MIT | |
| 5.4.3 | >=5.3.0 | MIT | |
| 5.4.2 | >=5.3.0 | MIT | |
| 5.4.1 | >=5.3.0 | MIT | |
| 5.4.0 | >=5.3.0 | MIT | |
| v3.0.0 | >=5.3.0 | MIT | |
| v2.0.2 | >=5.3.0 | MIT | |
| v2.0.1 | >=5.3.0 | MIT | |
| v2.0.0 | >=5.3.0 | MIT | |
| v1.0.2 | >=5.3.0 | MIT | |
| v1.0.1 | >=5.3.0 | MIT | |
| v1.0.0 | >=5.3.0 |