thomasvargiu / proxy-manager-module
A ZF2 module which allows to configure and use Ocramius/ProxyManager via ServiceManager
Installs: 1 506
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.4
- ocramius/proxy-manager: ~1.0
- zendframework/zend-modulemanager: ~2.2
- zendframework/zend-servicemanager: ~2.2
- zendframework/zend-stdlib: ~2.2
Requires (Dev)
- fabpot/php-cs-fixer: @stable
- phpmd/phpmd: @stable
- phpunit/phpunit: @stable
- squizlabs/php_codesniffer: @stable
- zendframework/zendframework: ~2.2
This package is auto-updated.
Last update: 2022-02-01 12:44:43 UTC
README
Status: development
ZF2 module that allows simplified use of Ocramius/ProxyManager registering factories in the service manager.
Configuration
return [ 'proxy_manager_module' => [ 'configuration' => [ /* * Proxies namespace * * A namespace for proxies */ // 'proxies_namespace' => '', /* * Proxies Target Directory * * Where to save proxies */ // 'proxies_target_dir' => './data/ProxyManager', /* * Generator Strategy * * An instance of ProxyManager\GeneratorStrategy\GeneratorStrategyInterface * or a service name in the service locator */ // 'generator_strategy' => '', /* * Proxy autoloader * * An instance of ProxyManager\Autoloader\AutoloaderInterface * or a service name in the service locator */ // 'proxy_autoloader' => '', /* * Class name inflector * * An instance of ProxyManager\Inflector\ClassNameInflectorInterface * or a service name in the service locator */ // 'class_name_inflector' => '', ], ], ];
Registered Factories
return [ 'service_manager' => [ 'factories' => [ 'ProxyManager\\Configuration' => 'ProxyManagerModule\\Factory\\ConfigurationFactory', 'ProxyManager\\Factory\\AccessInterceptorScopeLocalizerFactory' => 'ProxyManagerModule\\Factory\\AccessInterceptorScopeLocalizerFactoryFactory', 'ProxyManager\\Factory\\AccessInterceptorValueHolderFactory' => 'ProxyManagerModule\\Factory\\AccessInterceptorValueHolderFactoryFactory', 'ProxyManager\\Factory\\LazyLoadingGhostFactory' => 'ProxyManagerModule\\Factory\\LazyLoadingGhostFactoryFactory', 'ProxyManager\\Factory\\LazyLoadingValueHolderFactory' => 'ProxyManagerModule\\Factory\\LazyLoadingValueHolderFactoryFactory', 'ProxyManager\\Factory\\NullObjectFactory' => 'ProxyManagerModule\\Factory\\NullObjectFactoryFactory', ], ], ];
Configuration
ProxyManager\Configuration
: Create the ProxyManager configuration from config
Factories
These are factories created using configuration created by ProxyManager\Configuration
service factory:
ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory
ProxyManager\Factory\AccessInterceptorValueHolderFactory
ProxyManager\Factory\LazyLoadingGhostFactory
ProxyManager\Factory\LazyLoadingValueHolderFactory
ProxyManager\Factory\NullObjectFactory
How to use
You can request a Proxy Factory by getting the factory via service manager.
/** @var \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator */ $serviceLocator = $this->getServiceLocator(); /** @var \ProxyManager\Factory\LazyLoadingGhostFactory $proxyFactory */ $proxyFactory = $serviceLocator->get('ProxyManager\\Factory\\LazyLoadingGhostFactory');
Of course, you can register alias names in the service_manager
config key.