hackweekender-aw / spryker-autowiring
This package enables autowiring for Spryker
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/hackweekender-aw/spryker-autowiring
Requires
- php: >=8.0
- php-di/php-di: dev-master
- spryker/kernel: ^3.73
This package is not auto-updated.
Last update: 2025-09-29 19:12:25 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\ClassResolverAwareTrait
in the controller - Call
$this->resolveClass(AmazingYvesClass::class)->yourAmazingMethod()
Client
- Include
\AW\Client\Kernel\ClassResolverAwareTrait
in the client - Call
$this->resolveClass(AmazingClientClass::class)->yourAmazingMethod()
Zed
- Include
\AW\Zed\Kernel\ClassResolverAwareTrait
in 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())
];
}