PHP code example of inviqa / symfony-container-generator

1. Go to this page and download the library: Download inviqa/symfony-container-generator 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/ */

    

inviqa / symfony-container-generator example snippets


$generatorConfiguration = ContainerTools\Configuration::fromParameters(
    '/var/cache/container.php',              // name of file for compiled container
    ['/etc/services/', '/project/services'], // where to expect services.xml and services_test.xml
    true |                                   // debug mode - caches container.php with meta file and only regenerates when resources are modified
    false,                                   // production mode - caches container.php and doesn't regenerate unless deleted
    'xml'|'yml'                              // services extension 'xml' or 'yml'
);

    $generator = new \ContainerTools\ContainerGenerator($generatorConfiguration);
    
    $container = $generator->getContainer();
    
    $mailer = $container->get('acme.mailer');

$generatorConfiguration->setTestEnvironment(true);