Skip to content

Instantly share code, notes, and snippets.

View carteni's full-sized avatar

Francesco Cartenì carteni

View GitHub Profile
@carteni
carteni / config_test.yml
Last active June 6, 2017 15:57
Set HTTP_HOST header on requests in Symfony functional tests.
parameters:
test.client.parameters: { 'HTTP_HOST': 'example.com' }
# ...
@carteni
carteni / AppKernel.php
Last active September 25, 2021 10:47
Symfony Dependency Injection. Create a custom config loader.
<?php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function registerBundles()
{
// ...
@carteni
carteni / config.php
Last active May 30, 2017 10:08
Symfony Dependency Injection. Simple ClosureLoader usage.
<?php
namespace Symfony\Component\DependencyInjection\Loader
{
$resource = function ($container) {
$config = new namespace\AppBundle\DI\ClosureConfig();
$config($container);
};
$loader->resolve($resource, null)->load($resource, null);
@carteni
carteni / AppKernel.php
Last active February 9, 2017 11:56
Symfony Validation / Caching using Predis and CacheBundle (PSR-6).
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
@carteni
carteni / AppKernel.php
Last active February 9, 2017 11:23
Symfony Validation / Caching ClassMetadata information using Predis and DoctrineCacheBundle.
<?php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
@carteni
carteni / config.yml
Created February 7, 2017 08:47
Symfony Validation / Caching ClassMetadata information using Doctrine FilesystemCache.
framework:
validation: { enable_annotations: true, cache: validator.mapping.cache.doctrine.filesystem_cache }
@carteni
carteni / config.yml
Created February 7, 2017 08:42
Symfony Validation / Caching ClassMetadata information using Predis.
framework:
validation: { enable_annotations: true, cache: validator.mapping.cache.doctrine.predis_cache }
@carteni
carteni / AppBundle.php
Last active May 12, 2021 08:30
[Twig] Refreshing modified Templates when OPcache or APC is enabled.
<?php
/**
* @file src/AppBundle/AppBundle.php
*/
namespace AppBundle;
use AppBundle\DependencyInjection\Compiler\TwigCacheFileSystemPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;