PHP code example of ehough / iconic

1. Go to this page and download the library: Download ehough/iconic 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/ */

    

ehough / iconic example snippets


$sc = new ehough_iconic_ContainerBuilder();
$sc
    ->register('foo', '%foo.class%')
    ->addArgument(new ehough_iconic_Reference('bar'))
;
$sc->setParameter('foo.class', 'Foo');

$sc->get('foo');

$sc = new ehough_iconic_ContainerBuilder();

$sc
    ->register('bar', '%bar.class%')
    ->addMethodCall('setFoo', array(new ehough_iconic_Reference('foo')))
;
$sc->setParameter('bar.class', 'Bar');

$sc->get('bar');

$sc = new ehough_iconic_ContainerBuilder();

$sc
    ->register('bar', '%bar.class%')
    ->setFactoryClass('%bar.class%')
    ->setFactoryMethod('getInstance')
    ->addArgument('Aarrg!!!')
;
$sc->setParameter('bar.class', 'Bar');

$sc->get('bar');

$sc = new ehough_iconic_ContainerBuilder();

$sc
    ->register('bar', '%bar.class%')
    ->setFile('/path/to/file')
    ->addArgument('Aarrg!!!')
;
$sc->setParameter('bar.class', 'Bar');

$sc->get('bar');