rodmcnew/symfonize-zf

允许您在Zend Framework 2应用程序中使用Symfony 2扩展包

1.2.1 2015-12-31 17:14 UTC

This package is auto-updated.

Last update: 2024-09-11 14:57:01 UTC


README

SymfonizeZF 允许您将Symfony 2扩展包包含到您的Zend Framework 2应用程序中。

Symfonize 提供以下3个特性,以确保Symfony扩展包的无缝集成

####扩展包加载器

  • 通过application.config.php配置扩展包加载。这通过缓存DI配置和路由来提高性能。

####容器桥接器

  • 一个连接SF DI容器和ZF服务管理器的桥接器。SF容器对ZF模块定义的服务请求有效。从ZF服务管理器对SF扩展包定义的服务请求也有效。

####路由桥接器

  • 一个路由桥接器,允许将SF扩展包定义的路由分派到SF控制器。Symfony不会启动ZF定义的路由。

####如何安装和注册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'
    ]
]