binjuhor/blade
Composer 安装命令:
composer require binjuhor/blade
包简介
Laravel blade standalone for generate HTML CSS JS page
README 文档
README
This is a standalone blade template engine for PHP. It is a simple and easy to use template engine that is designed to be used in any PHP project.
Installation
You can install this package via composer using this command:
composer require binjuhor/blade
Usage
use Binjuhor\Blade\BladeTemplate; $template = new BladeTemplate([ 'views' => 'path/to/views/folder', 'cache' => 'path/to/cache/folder', 'compileDir' => 'path/to/compiled/folder', 'url' => 'http://your-app-url.test' ]); echo $template->render('view', ['data' => 'value']);
Read more about the blade template engine here.
To compile blade templates
You can use the compile method to compile blade templates. For example, if you have a blade template called home.blade.php and you want to compile it, you can do so by calling the compile method.
$template->compile();
Example
require_once "vendor/autoload.php"; use Binjuhor\Blade\BladeTemplate as Blade; $compileDir = __DIR__ . '/compiles'; $viewDirectory = __DIR__ . '/resources/views'; $cacheDirectory = __DIR__ . '/cache'; $page = isset($_REQUEST['f']) ? $_REQUEST['f'] : 'index'; $blade = new Blade([ 'view' => $viewDirectory, 'cache' => $cacheDirectory, 'compileDir' => $compileDir, 'url' => 'http://html-generator.test' ]); echo $blade->render($page); $blade->compiles();
Sample project directory structure
./index.php
./cache
./compiles
./resources
/assets
/css
/js
/images
/views
about.blade.php
contact.blade.php
home.blade.php
404.blade.php
/partials
header.blade.php
footer.blade.php
sidebar.blade.php
Check out the example directory for a complete example.
License
The MIT License (MIT). Please see License File for more information.
Credits
- Blade template engine by Taylor Otwell
- This package is created by Binjuhor
binjuhor/blade 适用场景与选型建议
binjuhor/blade 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 156 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 binjuhor/blade 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 binjuhor/blade 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 156
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-18