cable8mm/stub-template 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cable8mm/stub-template

最新稳定版本:v1.0.0

Composer 安装命令:

composer require cable8mm/stub-template

包简介

The package is not a template engine, but you can use it like one to create stub files when needed.

README 文档

README

Coding Style Actions Run Tests Actions Latest Version on Packagist Packagist Dependency Version Total Downloads Packagist Stars

The package is not a template engine, but you can use it like one to create stub files when needed.

It needs to be used with Twig template syntax.

Installation

You can install the package via composer:

composer require cable8mm/stub-template

Usage

$stub = Stub::of(__DIR__.'/stubs/sample.stub',
  [
    'title' => 'Home Page',
    'colors' => ['red', 'blue', 'green'],
  ]
)->render()

or

$stub = Stub::of('stubs/sample.stub',
  [
    'title' => 'Home Page',
    'colors' => ['red', 'blue', 'green'],
  ],
  __DIR__
)->render()

stubs/sample.stub :

{{ title }} - <?php echo date('Y-m-d') ?>

<h1>Home</h1>
<p>Welcome to the home page, list of colors:</p>
<ul>
{% for color in colors %}
    <li>{{ color }}</li>
{% endfor %}
</ul>

Then,

Home Page - <?php echo date('Y-m-d') ?>

<h1>Home</h1>
<p>Welcome to the home page, list of colors:</p>
<ul>
    <li>red</li>
    <li>blue</li>
    <li>green</li>
</ul>

It make sure that php codes have NOT been executed.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email cable8mm@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate by Beyond Code.

统计信息

  • 总下载量: 407
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固