esdlabs/string-blade-compiler
Composer 安装命令:
composer require esdlabs/string-blade-compiler
包简介
Render Blade templates from string
README 文档
README
Render Blade templates from string value.
This is a fork from https://github.com/Flynsarmy/laravel-db-blade-compiler which uses Elequent model to pass in a template.
I have reworked it to allow for a generic array of the required fields to generates and return a compiled view from a blade-syntax template.
Version
This version 1 is for Laravel 4.2, version 2 is for Laravel 5.
Installation
Add the repository to composer.json:
"repositories": [
{
"name": "wpb/string-blade-compiler",
"url": "https://github.com/TerrePorter/StringBladeCompiler.git",
"type": "git"
}
],
Add the package to composer.json:
"require": {
"laravel/framework": "4.2.*",
"wpb/string-blade-compiler": "1.*@dev"
},
Add the ServiceProvider to the providers array in app/config/app.php
'Wpb\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
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' ) );
Also allows for Blade::extend, example :
// allows for @continue and @break in foreach in blade templates Blade::extend(function($value) { return preg_replace('/(\s*)@(break|continue)(\s*)/', '$1<?php $2; ?>$3', $value); });
License
string-blade-compiler is open-sourced software licensed under the MIT license
esdlabs/string-blade-compiler 适用场景与选型建议
esdlabs/string-blade-compiler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.08k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「compiler」 「blade」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 esdlabs/string-blade-compiler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 esdlabs/string-blade-compiler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 esdlabs/string-blade-compiler 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A token based Javascript parser/minifier designed for compressing inline scripts on the fly, written in PHP
A token based CSS Document parser and minifier written in PHP
A token based HTML document parser and minifier. Minify HTML documents including inline CSS, Javascript, and SVG's on the fly. Extract document text, attributes, and fragments. Full test suite.
Simple class that compiles Laravel Blade files
A configurable LESS compiler for Symfony projects.
Env builder is a package which collects different env files within a specified directory and compiles them into one single .env file, useful when you have different .env files laying around in different folders and you want to have one single big file that you can load with Symfony's DotEnv loader o
统计信息
- 总下载量: 10.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-02