PHP code example of piotrpolak / codeigniter-symfony2-bridge
1. Go to this page and download the library: Download piotrpolak/codeigniter-symfony2-bridge 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/ */
piotrpolak / codeigniter-symfony2-bridge example snippets
$bridge = new \PiotrPolak\CodeIgniterSymfonyBridge\Bridge('./symfonyRootDir');
try {
// \Symfony\Component\DependencyInjection\Container
$container = $bridge->getKernel()->getContainer();
} catch(\PiotrPolak\CodeIgniterSymfonyBridge\Exception\KernelInitializationException $e) {
// Unable to initialize Symfony2+ kernel
}
$bridge = new \PiotrPolak\CodeIgniterSymfonyBridge\Bridge('./symfonyRootDir');
try {
$result = $bridge->getKernel()->getContainer()->get('my_service')->businessLogicServiceMethod('parameter of a primitive type'));
} catch(\PiotrPolak\CodeIgniterSymfonyBridge\Exception\KernelInitializationException $e) {
// Unable to initialize Symfony2+ kernel
}
$bridge = new \PiotrPolak\CodeIgniterSymfonyBridge\Bridge('./symfonyRootDir');
try {
$em = $bridge->getKernel()->getContainer()->get('doctrine')->getManager();
} catch(\PiotrPolak\CodeIgniterSymfonyBridge\Exception\KernelInitializationException $e) {
// Unable to initialize Symfony2+ kernel
}
$bridge = new \PiotrPolak\CodeIgniterSymfonyBridge\Bridge('./symfonyRootDir');
try {
$container = $bridge->getKernel()->getContainer(); // Initializes Symfony2+ PSR class loader
$imageHelper = new \Pepis\ImageManipulationBundle\Helpers\ImageHelper();
} catch(\PiotrPolak\CodeIgniterSymfonyBridge\Exception\KernelInitializationException $e) {
// Unable to initialize Symfony2+ kernel
}