Using symfony/twig-bridge
in Expressive. (e.g.: asset,workflow)
在 Mezzio (Zend Expressive) 中使用部分的 symfony/twig-bridge
提供的 twig 扩展 (如: asset
,workflow
)
composer require zfegg/symfony-twig-factory
-
asset
-
code
-
dump
-
expression
-
\Symfony\Bridge\Twig\Extension\FormExtension
-
\Symfony\Bridge\Twig\Extension\TranslationExtension
-
\Symfony\Bridge\Twig\Extension\WorkflowExtension
-
\Symfony\Bridge\Twig\Extension\YamlExtension
Based on expressive.
You can add all extension configs or customize add you want.
你可以添加全部扩展配置,或者自定义添加您想要的。
Zfegg\SymfonyTwigFactory\ConfigProvider
Load all the configs of twig extensions. / 加载全部 twig 扩展配置.Zfegg\SymfonyTwigFactory\AssetConfigProvider
Symfony\Bridge\Twig\Extension\AssetExtension
Zfegg\SymfonyTwigFactory\BaseConfigProvider
Symfony\Bridge\Twig\Extension\ExpressionExtension
Symfony\Bridge\Twig\Extension\YamlExtension
Zfegg\SymfonyTwigFactory\FormConfigProvider
Symfony\Bridge\Twig\Extension\FormExtension
Zfegg\SymfonyTwigFactory\TranslationConfigProvider
Symfony\Bridge\Twig\Extension\TranslationExtension
Zfegg\SymfonyTwigFactory\WorkflowConfigProvider
Symfony\Bridge\Twig\Extension\WorkflowExtension
composer require symfony/asset
Add AssetConfigProvider
to config.php
file, if you just want to use AssetExtension
.
如果你只想要 AssetExtension
, 就添加AssetConfigProvider
到 config.php
配置文件中.
$aggregator = new ConfigAggregator([
// Only load `AssetExtension` configs.
Zfegg\SymfonyTwigFactory\AssetConfigProvider::class,
]);
Example file config/autoload/template.global.php
.
举例文件 config/autoload/template.global.php
.
return [
// asset component configs.
// asset 配置结构详见以下链接
// @See: http://symfony.com/doc/current/reference/configuration/framework.html#assets
'assets' => [
'base_path' => '/'
//Keys:
// - base_path
// - base_urls
// - packages
// - version
// - version_format
// - version_strategy
// - json_manifest_path
],
];
composer require symfony/form
Add FormConfigProvider
to config.php
file, if you just want to use FormExtension
.
如果你只想要 FormExtension
, 就添加FormConfigProvider
到 config.php
配置文件中.
$aggregator = new ConfigAggregator([
// Only load `FormExtension` configs.
Zfegg\SymfonyTwigFactory\FormConfigProvider::class,
]);
Example file config/autoload/template.global.php
.
举例文件 config/autoload/template.global.php
.
return [
// form themes configs. / 表单主题(form_themes)配置结构详见以下链接
// @See: https://symfony.com/doc/current/form/form_themes.html
// Add form themes.
// 'twig' => [
// 'form_themes' => [
// 'form/layout.html.twig'
// ],
// ],
];