PHP code example of draw / dependency-injection

1. Go to this page and download the library: Download draw/dependency-injection library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

draw / dependency-injection example snippets



namespace Example\Bundle\MyBundle\DependencyInjection;

use Draw\Component\DependencyInjection\IntegrationTrait;
use Example\Component\MyComponent\DependencyInjection\MyCompnentIntegration;
use Example\Component\MyOtherComponent\DependencyInjection\MyOtherComponentIntegration;

class ExampleMyBundle extends Bundle
{
    use ExtendableExtensionTrait;

    public function __construct()
    {
        $this->registerDefaultIntegrations();
    }

    private function provideExtensionClasses(): array
    {
        return [
            MyCompnentIntegration::class,
        ];
    }

    public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface
    {
        return new Configuration($this->integrations);
    }

    public function load(array $configs, ContainerBuilder $container): void
    {
        $config = $this->loadIntegrations($configs, $container);

        // Do your bundle specific configuration here
    }

    public function prepend(ContainerBuilder $container): void
    {
        $this->prependIntegrations($container, 'example_my_bundle');
    }
}