REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.70 KB
Close
/opt/alt/php54/usr/share/doc/pear/DependencyInjection/Symfony/Component/DependencyInjection/README.md
Text
Base64
DependencyInjection Component ============================= DependencyInjection manages your services via a robust and flexible Dependency Injection Container. Here is a simple example that shows how to register services and parameters: use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; $sc = new ContainerBuilder(); $sc ->register('foo', '%foo.class%') ->addArgument(new Reference('bar')) ; $sc->setParameter('foo.class', 'Foo'); $sc->get('foo'); Method Calls (Setter Injection): $sc = new ContainerBuilder(); $sc ->register('bar', '%bar.class%') ->addMethodCall('setFoo', array(new Reference('foo'))) ; $sc->setParameter('bar.class', 'Bar'); $sc->get('bar'); Factory Class: If your service is retrieved by calling a static method: $sc = new ContainerBuilder(); $sc ->register('bar', '%bar.class%') ->setFactoryClass('%bar.class%') ->setFactoryMethod('getInstance') ->addArgument('Aarrg!!!') ; $sc->setParameter('bar.class', 'Bar'); $sc->get('bar'); File Include: For some services, especially those that are difficult or impossible to autoload, you may need the container to include a file before instantiating your class. $sc = new ContainerBuilder(); $sc ->register('bar', '%bar.class%') ->setFile('/path/to/file') ->addArgument('Aarrg!!!') ; $sc->setParameter('bar.class', 'Bar'); $sc->get('bar'); Resources --------- You can run the unit tests with the following command: $ cd path/to/Symfony/Component/DependencyInjection/ $ composer.phar install $ phpunit
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
CHANGELOG.md
931 B
lrw-r--r--
2019-12-18 11:22:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
composer.json
1.07 KB
lrw-r--r--
2019-12-18 11:22:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LICENSE
1.04 KB
lrw-r--r--
2019-12-18 11:22:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
README.md
1.70 KB
lrw-r--r--
2019-12-18 11:22:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).