1. Go to this page and download the library: Download symplify/autodiscovery 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/ */
symplify / autodiscovery example snippets
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symplify\Autodiscovery\Discovery;
final class MyProjectKernel extends Kernel
{
use MicroKernelTrait;
/**
* @var Discovery
*/
private $discovery;
public function __construct()
{
parent::__construct('dev', true);
$this->discovery = new Discovery($this->getProjectDir());
}
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
{
$this->discovery->discoverEntityMappings($containerBuilder);
}
}
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
final class MyProjectKernel extends Kernel
{
use MicroKernelTrait;
// ...
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
{
$this->discovery->discoverTemplates($containerBuilder);
}
}
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
final class MyProjectKernel extends Kernel
{
use MicroKernelTrait;
// ...
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
{
$this->discovery->discoverTranslations($containerBuilder);
}
}
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
final class MyProjectKernel extends Kernel
{
use MicroKernelTrait;
protected function configureRoutes(RouteCollectionBuilder $routeCollectionBuilder): void
{
$this->discovery->discoverRoutes($routeCollectionBuilder);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.