reliv / symfonize-zf
1.2.1
2015-12-31 17:14 UTC
Requires
- php: >=5.5.0
- rodmcnew/symfonize-zf-container-bridge: >=1.1.1
- sensio/generator-bundle: >=2.3
- symfony/framework-standard-edition: 2.7.5
Requires (Dev)
- phpunit/phpunit: 4.8.*
- squizlabs/php_codesniffer: 2.3.3
README
SymfonizeZF 允许您将 Symfony 2 扩展包包含到您的 Zend Framework 2 应用程序中。
Symfonize 提供以下 3 个特性以确保 Symfony 扩展包的流畅集成
####扩展包加载器
- 通过 application.config.php 配置扩展包加载。这缓存了依赖注入配置和路由以提高性能。
####容器桥接器
- SF 依赖注入容器与 ZF 服务管理器之间的桥接器。从 SF 容器请求 ZF 模块定义的服务可行。从 ZF 服务管理器请求 SF 扩展包定义的服务也可行。
####路由桥接器
- 允许将 SF 扩展包定义的路由分派到 SF 控制器的路由桥接器。对于 ZF 定义的路由,Symfony 不需要启动。
####如何安装和注册 Symfony 扩展包
// In config/autoload/application.config.php [ 'modules' => [ //Add Symfonize modules to the end of your ZF modules list. 'Reliv\\SymfonizeZF', 'Reliv\\SymfonizeZFContainerBridge', ], 'symfonize_zf' => [ /** * This is the place to register your own bundles. This is similar to: * https://symfony.ac.cn/doc/current/cookbook/bundles/installation.html */ 'bundles' => [ new \MyOwnFun\MyOwnFunBundle(), ], /** * These bundles do not load for zend routes. They only load if * a Symfony route is detected and Symfony is booted. */ 'symfony_only_bundles' => [ new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new \Symfony\Bundle\SecurityBundle\SecurityBundle(), new \Symfony\Bundle\TwigBundle\TwigBundle(), new \Symfony\Bundle\MonologBundle\MonologBundle(), new \Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new \Symfony\Bundle\AsseticBundle\AsseticBundle(), new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), ], /** * These bundles load only if environment is dev or test. * These bundles do not load for zend routes. */ 'symfony_only_dev_bundles' => [ new \Symfony\Bundle\DebugBundle\DebugBundle(), new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(), new \Sensio\Bundle\DistributionBundle\SensioDistributionBundle(), new \Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(), ], 'environment' => $onProd ? 'prod' : 'dev', /** * Should be true on dev, and false on prod. This disables caching. */ 'debug' => !$onProd, /** * Cache files are written here */ 'cache_dir' => __DIR__ . '/../data/SymfonizeZf', /** * Log files go here */ 'log_dir' => __DIR__ . '/../data/SymfonizeZf/log', /** * This can be changed if you want to control your own Symfony root */ 'symfony_root_dir' => __DIR__ . '/../vendor/reliv/symfonize-zf/SymfonyRoot' ] ]