abitofmaya/blade-renderer
Composer 安装命令:
composer require abitofmaya/blade-renderer
包简介
Standalone Blade Template Renderer
README 文档
README
Blade Renderer is a simple wrapper around illuminate/view, the package that powers the Blade templating engine used with Laravel.
This package allows Blade's powerful and expressive syntax to be uesd in any PHP project without needing to install the full Laravel framework. It abstracts the setup and configuration needed to render blade templates, making it more accessible and straightforward for use in non-Laravel projects.
It uses a similar directory structure as Laravel for organizing views and caches.
The views are stored at the resources/views directory and the view caches at storage/framework/views.
Usage
Blade Renderer can be used in either of the following two ways.
As a Standalone Project
You can use Blade Renderer to quickly start a new standalone project. To do this, follow these steps:
-
Create a New Project
Run the following command in your terminal to create a new project.
composer create-project abitofmaya/blade-renderer <project-name>
-
Run the Development Server
Navigate into the project directory and start a PHP development server by running:
php -S localhost:8000 -t public
Example
-
Edit
src/app.phpwith the following contents:<?php use abitofmaya\BladeRenderer\BladeRenderer; $renderer = new BladeRenderer(); $posts = [ [ 'title' => 'The Art of Minimalism: Living with Less', 'description' => 'Learn how to declutter your life and find happiness in simplicity.' ], [ 'title' => 'The Future of Technology', 'description' => 'Dive into the technological advancements shaping the future.' ] ]; echo $renderer->view(view: 'bladeRenderer', data: ['posts' => $posts]);
-
Create
bladeRenderer.blade.phpinresources/viewsdirectory with the following contents.<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Blade Renderer</title> </head> <body> @foreach($posts as $post) <div> <p><strong>Title</strong>: {{ $post['title'] }}</p> <p><strong>Description</strong>: {{ $post['description'] }}</p> </div> @endforeach </body> </html>
As a Dependency in an Existing Project
If you have an existing PHP project and want to add Blade templating capabilities, you can include Blade Renderer as a project dependency. Here's how:
-
Install the Package
Run the following command in your terminal to install Blade Renderer.
composer require abitofmaya/blade-renderer
-
Setup Directory Structure
After installation, you will need to manually set up the directory structure for the views and caches. Create the following directories:
resources/viewsfor storing your Blade templates.storage/framework/viewsfor storing view caches.
abitofmaya/blade-renderer 适用场景与选型建议
abitofmaya/blade-renderer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「template」 「blade」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 abitofmaya/blade-renderer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 abitofmaya/blade-renderer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 abitofmaya/blade-renderer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple ASCII output of array data
E2E Studios PHP Framework adaptation of leafsphp/blade package
Ensolab template project
Account Balance / Wallets Manager For FilamentPHP and Filament Account Builder
Render blade templates into a PSR-7 Response object.
A tiny Flask-like PHP microframework where each public method is an endpoint and routes are inferred from method names.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-24