1. Go to this page and download the library: Download symplify/amnesia 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 / amnesia example snippets
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\Amnesia\ValueObject\Symfony\Extension\FrameworkExtension;
use function Symplify\Amnesia\Functions\env;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension(FrameworkExtension::NAME, [
FrameworkExtension::SECRET => env('APP_SECRET'),
]);
};
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\Amnesia\ValueObject\Symfony\Extension\Twig\NumberFormat;
use Symplify\Amnesia\ValueObject\Symfony\Extension\TwigExtension;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension(TwigExtension::NAME, [
TwigExtension::DEFAULT_PATH => '%kernel.project_dir%/templates',
TwigExtension::PATHS => [__DIR__ . '/../../packages/framework-stats/templates'],
TwigExtension::GLOBALS => [
'site_title' => 'Tomas Votruba',
],
// see https://symfony.com/blog/new-in-symfony-2-7-default-date-and-number-format-configuration
TwigExtension::NUMBER_FORMAT => [
NumberFormat::DECIMALS => 0,
NumberFormat::DECIMAL_POINT => '.',
NumberFormat::THOUSANDS_SEPARATOR => ' ',
],
]);
};
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Symplify\Amnesia\ValueObject\Symfony\Routing;
return static function (RoutingConfigurator $routes): void {
$routes->import(__DIR__ . '/../src/Controller', Routing::TYPE_ANNOTATION);
};
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\Amnesia\ValueObject\Symfony\Extension\Doctrine\DBAL;
use Symplify\Amnesia\ValueObject\Symfony\Extension\Doctrine\Mapping;
use Symplify\Amnesia\ValueObject\Symfony\Extension\Doctrine\ORM;
use Symplify\Amnesia\ValueObject\Symfony\Extension\DoctrineExtension;
use function Symplify\Amnesia\Functions\env;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension(DoctrineExtension::NAME, [
DoctrineExtension::DBAL => [
DBAL::HOST => env('DATABASE_HOST'),
DBAL::DBNAME => env('DATABASE_DBNAME'),
DBAL::USER => env('DATABASE_USER'),
DBAL::PASSWORD => env('DATABASE_PASSWORD'),
],
DoctrineExtension::ORM => [
ORM::AUTO_GENERATE_PROXY_CLASSES => true,
ORM::MAPPINGS => [
'demo' => [
Mapping::IS_BUNDLE => false,
Mapping::DIR => __DIR__ . '/../../packages/demo/src/Entity',
Mapping::PREFIX => 'Rector\Website\Demo\Entity',
],
],
],
]);
};
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.