承接 liquidbox/silex-plates 相关项目开发

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

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

liquidbox/silex-plates

Composer 安装命令:

composer require liquidbox/silex-plates

包简介

A Plates template engine service provider for the Silex micro-framework

README 文档

README

GitHub release license Build Status Code Coverage Scrutinizer Code Quality Packagist

You are reading the documentation for Silex 2.x. Switch to the documentation for Silex 1.x.

Plates

The PlatesServiceProvider provides integration with the Plates template engine.

Parameters

  • plates.directory (optional): The default template directory.
  • plates.file_extension (optional): The template file extension.
  • plates.folders (optional): A collection of template folders to add for grouping templates under different namespaces.
  • plates.data (optional): A collection of data shared with all templates to add.
  • plates.functions (optional): A collection of template functions to register.
  • plates.extension.asset (optional): The asset extension directory to load that adds the ability to create "cache busted" asset URLs.

Services

  • plates: The Engine instance. The main way of interacting with Plates.
  • plates.engine_factory: Factory for Engine instances.
  • plates.loader: The loader for Plates templates which uses the plates.folders, plates.data, and plates.functions options.
  • plates.extension_loader.asset: Create new Asset extension instance that adds the ability to create "cache busted" asset URLs.

Registering

$app->register(new \LiquidBox\Silex\Provider\PlatesServiceProvider(), array(
    'plates.directory' => '/path/to/templates',
    'plates.folders' => array(
        'email' => '/path/to/email/templates',
    ),
));

Add Plates as a dependency:

composer require liquidbox/silex-plates:^2.0

Usage

// Add any additional folders
$app['plates']->addFolder('emails', '/path/to/emails');

// Load asset extension
$app['plates.extension_loader.asset']('/path/to/public');

// Create a new template
$template = $app['plates']->make('emails::welcome');

Symfony Components Integration

The PlatesServiceProvider provides additional integration between some Symfony components and Plates. This will provide you with the following additional capabilities.

Routing Support

If you are using the UrlGeneratorServiceProvider, you will have access to the path() and url() functions. You can find more information in the Symfony Routing documentation.

Security Support

If you are using the SecurityServiceProvider, you will have access to the is_granted() function in templates. You can find more information in the Symfony Security documentation.

Customization

You can configure the Plates environment before using it when registering the plates service:

$app->register(new \LiquidBox\Silex\Provider\PlatesServiceProvider(), array(
    'plates.data' => array(
        'title' => 'Plates - Native PHP Templates',
    ),
    'plates.functions' => array(
        'uppercase' => function ($string) {
            return strtoupper($string);
        },
    ),
));

For more information, check out the official Plates documentation.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固