承接 setono/php-templates-bundle 相关项目开发

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

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

setono/php-templates-bundle

Composer 安装命令:

composer require setono/php-templates-bundle

包简介

A Symfony bundle that integrates the php templates library

README 文档

README

Latest Version Latest Unstable Version Software License Build Status Coverage Status Quality Score

This bundle integrates the PHP templates library into Symfony.

Installation

Step 1: Download

$ composer require setono/php-templates-bundle

Step 2: Enable the bundle

If you use Symfony Flex it will be enabled automatically. Else you need to add it to the config/bundles.php:

<?php
// config/bundles.php

return [
    // ...
    Setono\PhpTemplatesBundle\SetonoPhpTemplatesBundle::class => ['all' => true],
    // ...
];

Usage

Service usage

The bundle registers the service setono_php_templates.engine.default and also autowires the interface Setono\PhpTemplates\Engine\EngineInterface to that default engine. This means you can inject the engine just by type hinting the interface:

<?php
use Setono\PhpTemplates\Engine\EngineInterface;

final class YourService
{
    /** @var EngineInterface */
    private $engine;

    public function __construct(EngineInterface $engine) {
        $this->engine = $engine;
    }

    public function __invoke(): string
    {
        return $this->engine->render('YourNamespace/template', [
            'parameter' => 'value'
        ]);
    }
}

Templates

The bundle automatically adds paths to the template engine. It is predefined to src/Resources/views/php for bundles and templates/php for applications.

This means if you put templates (according the correct structure) you can use templates seamlessly as described in the original docs.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固