bndrmrtn/flamephp_engine
Composer 安装命令:
composer require bndrmrtn/flamephp_engine
包简介
Drop the old PHP <?= syntax and never use it again, the solution is *.flame.php wich converts {{ $title }} to <?php echo $title ?> and @foreach(...) ... @endforeach to <?php foreach(...): ?> ... <?php endforeach ?>, so UI development is not a PAIN anymore with flamephp_engine
README 文档
README
How to add to a project?
Install it via composer and add it to your file.
composer require bndrmrtn/flamephp_engine:dev-main
require_once 'vendor/autoload.php';
Configure or use the default config
use Bndrmrtn\FlamephpEngine\FlamePHP; use Bndrmrtn\FlamephpEngine\FlamePHP\Config; $flame = new FlamePHP( viewsDirectory: '...', // The directory where you store your views useDevelopmentMode: true, // Your project is in development mode or not cacheDirectory: '...', // The directory where you want to store your cache data config: new Config, // Custom config, or use the default );
How to use it?
You can use it with *.flame.php files with a directory named views in your root folder, or the parseString option that doesn't requires any file. (Except the cache files that auto generated by this tool).
Code examples
With the textParser option
use Bndrmrtn\FlamephpEngine\FlamePHP; $flame = new FlamePHP; $flame->parseString(' <h1>Hello {{ $world }}</h1> ', ['world' => 'Developer'], ); // <h1>Hello Developer</h1>
With the file option
// ... $flame->includeFile( 'filename', // without the .flame.php extension! ['name' => 'John'] // add props to it );
Actually you can get the path of the file's cache with the parseFile method, like this:
// ... $parsed_file = $flame->parseFile( 'filename', // without the .flame.php extension! // No props here ); echo $parsed_file; // output: C:\...\your_project\flamephp_engine\cache\views\filename.flame.php
Demo
You can check the /tests folder and run the tests with PHPUnit
Documentation
Here FlameCore Official Views Documentation you can find a small documentation of how it works, but I must remind you that it documents a modified version and that you should follow the default settings as described above!
Credits
Martin Binder, FullStack Web Developer, 4 years of experience with PHP, 3 with Laravel. Currently I am learning GoLang ;)
bndrmrtn/flamephp_engine 适用场景与选型建议
bndrmrtn/flamephp_engine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bndrmrtn/flamephp_engine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bndrmrtn/flamephp_engine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-11-01