承接 cable8mm/stub-template 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱: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.

统计信息

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

GitHub 信息

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

其他信息

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