zfegg / symfony-twig-factory
Using symfony/twig-bridge in Mezzio. (e.g.: asset,workflow)
Requires
- php: >=7.3
- psr/container: ^1.0 | ^2.0
- symfony/twig-bridge: ^4.0 | ^5.0 | ^6.0
Requires (Dev)
- laminas/laminas-coding-standard: ^2.3.0
- laminas/laminas-servicemanager: ^3.3
- mezzio/mezzio-twigrenderer: ^2.3
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: 9.5.16
- symfony/asset: ^4.0 | ^5.0 | ^6.0
- symfony/expression-language: ^4.2 | ^5.0
- symfony/form: ^4.0.9 | ^5.0 | ^6.0
- symfony/security-csrf: ^4.2 | ^5.0 | ^6.0
- symfony/translation: ^4.2 | ^5.0 | ^6.0
- symfony/workflow: ^4.0 | ^5.0 | ^6.0
- symfony/yaml: ^4.0 | ^5.0 | ^6.0
Suggests
- symfony/asset: Asset factory required
This package is auto-updated.
Last update: 2024-11-25 11:43:05 UTC
README
Using symfony/twig-bridge
in Expressive. (e.g.: asset,workflow)
在 Mezzio (Zend Expressive) 中使用部分的 symfony/twig-bridge
提供的 twig 扩展 (如: asset
,workflow
)
Installation / 安装
composer require zfegg/symfony-twig-factory
TODO factories / 需实现的twig扩展
-
asset
-
code
-
dump
-
expression
-
\Symfony\Bridge\Twig\Extension\FormExtension
-
\Symfony\Bridge\Twig\Extension\TranslationExtension
-
\Symfony\Bridge\Twig\Extension\WorkflowExtension
-
\Symfony\Bridge\Twig\Extension\YamlExtension
Usage / 使用
Based on expressive.
Add all symfony twig extension in 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
Asset extension usage / asset 扩展使用
1. Add symfony/asset
library. / 添加 symfony/asset
扩展
composer require symfony/asset
2. Add config provider in project config.php
. / 在项目中添加配置
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, ]);
3. Add config in project. / 在项目中添加配置
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 ], ];
Form extension usage / form 扩展使用
1. Add symfony/form
library. / 添加 symfony/form
扩展
composer require symfony/form
2. Add config provider in project config.php
. / 在项目中添加配置
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, ]);
3. More form configs in project. / 在项目中表单的配置
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' // ], // ], ];