Skip to content

Instantly share code, notes, and snippets.

@mylk
mylk / VatCheckerService.php
Created August 14, 2016 17:21
VIES VAT checker service (uses europe.eu)
<?php
/*
* Installation (Symfony):
* =======================
* # services.yml
* services:
* # ...
* acme.vat_checker:
* class: Acme\AcmeBundle\Service\VatCheckerService
@mylk
mylk / CountryExtension.php
Last active March 25, 2019 13:49
Twig extension that adds a filter that returns the country name by its 2-letter ISO code
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* # ...
* acme.twig.country_extension:
* class: Acme\AcmeBundle\Twig\CountryExtension
<?php
namespace AppBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
class AddEntityChoiceSubscriber implements EventSubscriberInterface
@samsch
samsch / README.md
Created January 21, 2016 16:38
How to set PDO MySQL SSL Constants in Symfony

I created this because I was frusterated by having to change the integer values when the environments changed for my projects. A simple update of PHP 5.6 (I think it was PHP 5.6.16 to 5.6.17) changed the integer values, which are usually what is suggested to be used in parameters.yml or config.yml.

By using the constants, you don't have to worry about stupid stuff like that. (Since that's what they were designed for.)