PHP code example of mmoreram / symfony-bundle-dependencies
1. Go to this page and download the library: Download mmoreram/symfony-bundle-dependencies 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/ */
mmoreram / symfony-bundle-dependencies example snippets
php
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Mmoreram\SymfonyBundleDependencies\DependentBundleInterface;
/**
* My Bundle
*/
class MyBundle extends Bundle implements DependentBundleInterface
{
/**
* Create instance of current bundle, and return dependent bundle namespaces
*
* @return array Bundle instances
*/
public static function getBundleDependencies(KernelInterface $kernel)
{
return [
'Another\Bundle\AnotherBundle',
'My\Great\Bundle\MyGreatBundle',
// ...
];
}
}
php
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Mmoreram\SymfonyBundleDependencies\DependentBundleInterface;
/**
* My Bundle
*/
class MyBundle extends Bundle implements DependentBundleInterface
{
/**
* Create instance of current bundle, and return dependent bundle namespaces
*
* @return array Bundle instances
*/
public static function getBundleDependencies(KernelInterface $kernel)
{
return [
'Another\Bundle\AnotherBundle',
'My\Great\Bundle\MyGreatBundle',
new \Even\Another\Bundle\EvenAnotherBundle('some-value'),
];
}
}
php
use Mmoreram\SymfonyBundleDependencies\DependentBundleInterface;
/**
* My Bundle
*/
class MyBundle implements DependentBundleInterface
{
/**
* Create instance of current bundle, and return dependent bundle namespaces
*
* @return array Bundle instances
*/
public static function getBundleDependencies(KernelInterface $kernel)
{
return [
new \Even\Another\Bundle\EvenAnotherBundle($this),
];
}
}
php
use Symfony\Component\HttpKernel\Kernel;
use Mmoreram\SymfonyBundleDependencies\BundleDependenciesResolver;
/**
* Class AppKernel
*/
class AppKernel extends Kernel
{
use BundleDependenciesResolver;
/**
* Register application bundles
*
* @return array Array of bundles instances
*/
public function registerBundles()
{
return $this->getBundleInstances([
new \My\Bundle\MyBundle($this),
]);
}
}
php
use Mmoreram\SymfonyBundleDependencies\CachedBundleDependenciesResolver;
/**
* Class AppKernel
*/
class AppKernel
{
use CachedBundleDependenciesResolver;
/**
* Register application bundles
*
* @return array Array of bundles instances
*/
public function registerBundles()
{
return $this->getBundleInstances([
'\My\Bundle\MyBundle',
]);
}
}
php
use Symfony\Component\HttpKernel\Kernel;
use Mmoreram\SymfonyBundleDependencies\BundleDependenciesResolver;
/**
* Class AppKernel
*/
class AppKernel extends Kernel
{
use BundleDependenciesResolver;
/**
* Register application bundles
*
* @return array Array of bundles instances
*/
public function registerBundles()
{
return $this->getBundleInstances([
new \My\Bundle\MyBundle($this, true),
'Another\Bundle\AnotherBundle',
'My\Great\Bundle\MyGreatBundle',
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.