hackweekender-aw / spryker-autowiring
This package enables autowiring for Spryker
Package info
github.com/RodinVasily/spryker-autowiring
pkg:composer/hackweekender-aw/spryker-autowiring
dev-main
2023-07-09 10:19 UTC
Requires
- php: >=8.0
- php-di/php-di: dev-master
- spryker/kernel: ^3.73
This package is not auto-updated.
Last update: 2026-03-16 21:25:38 UTC
README
#Hackweekender2023
Installation
Install it with composer
composer require hackweekender-aw/spryker-autowiring
Add a namespace to your config
$config[KernelConstants::CORE_NAMESPACES] = [
[...]
'AW'
];
Usage
Yves
- Include
\AW\Yves\Kernel\ClassResolverAwareTraitin the controller - Call
$this->resolveClass(AmazingYvesClass::class)->yourAmazingMethod()
Client
- Include
\AW\Client\Kernel\ClassResolverAwareTraitin the client - Call
$this->resolveClass(AmazingClientClass::class)->yourAmazingMethod()
Zed
- Include
\AW\Zed\Kernel\ClassResolverAwareTraitin the facade - Call
$this->resolveClass(AmazingZedClass::class)->yourAmazingMethod()
Manually configure DI
- Make the dependency provider of your module to implement the interface
\AW\Shared\Kernel\DependencyInjection\ConfigurableDependencyInjectionInterface - Define the custom definitions using https://php-di.org/doc/php-definitions.html#definition-types
public function getDependencyInjectionConfig(): array
{
return [
AmazingCartOperationInterface::class => DI\autowire(AmazingCartOperation::class)
->constructorParameter('postOperationPlugins', $this->getPostOperationPlugins())
];
}