Skip to content

Instantly share code, notes, and snippets.


Ryan Weaver weaverryan

View GitHub Profile
weaverryan / CheeseNormalizer.php
Created Jun 30, 2020
inlining children of a self-referencing to an IRI in API Platform
View CheeseNormalizer.php
namespace App\Serializer\Normalizer;
use App\Entity\CheeseListing;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
weaverryan /
Last active Apr 28, 2020
Symfony Core Meeting Logs
Date Topics URL Summary
May 21st, 2015 core team organization, issue tagging/organization, PSR-7 logs --
June 4th, 2015 PSR-HttpFoundation, DI-PSR, issue triaging/organization, meeting organization logs --
June 18th, 2015 workflow/notifications, removing forums/ML, 3.0 changes - templating logs --
July 2nd, 2015 issues bot / HttpFoundation PSR-7 / dropping templating / new SE structure/ config component split / HttpKernel split logs summary
July 16th, 2015 issues bot / updates on initiatives / closing old issues logs --
July 30th, 2015 deprecatio
weaverryan / ApiTestCase.php
Last active Sep 23, 2019
Example Symfony ApiTestCase (from WIP KnpUniversity Symfony REST tutorial)
View ApiTestCase.php
namespace AppBundle\Tests\Controller\Api;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\ORM\EntityManager;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use GuzzleHttp\Subscriber\History;
weaverryan / index.php
Created Oct 29, 2015
Potential Symfony MicroKernel example
View index.php
require_once __DIR__.'/../vendor/autoload.php';
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\MicroKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
weaverryan / Controller.php
Created Apr 21, 2015
Collecting Form Errors
View Controller.php
// put this in your controller
protected function getErrorsFromForm(FormInterface $form)
$errors = array();
foreach ($form->getErrors() as $error) {
$errors[] = $error->getMessage();
weaverryan / UniversityExtension.php
Last active Jul 9, 2018
Twig Extension with ContainerInterface injected
View UniversityExtension.php
class UniversityExtension extends \Twig_Extension
private $container;
* An internal cache used to prevent creating this chain loader multiple times
private $twigChainLoader;
weaverryan / console.php
Last active May 14, 2018
working on console
View console.php
#!/usr/bin/env php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
weaverryan / AccessDeniedHandler.php
Created Mar 22, 2017
Access Denied Flash Message
View AccessDeniedHandler.php
namespace AppBundle\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
use Symfony\Component\Routing\RouterInterface;
class AccessDeniedHandler implements AccessDeniedHandlerInterface
weaverryan / FeatureContext.php
Created Jun 19, 2012
Behat Definition to help click generic links on different rows of a table
View FeatureContext.php
// ...
class FeatureContext extends MinkContext
* Looks for a table, then looks for a row that contains the given text.
* Once it finds the right row, it clicks a link in that row.
weaverryan /
Created Feb 8, 2018
PhpStorm Users with Symfony!

PhpStorm has some AWESOME plugins for Symfony.

To install them:

  1. Open the PhpStorm "Preferences"
  2. Search "Symfony" and select the top-level Plugin menu item
  3. Near the bottom, click the "Browse Repositories" button

Browse Repositories

You can’t perform that action at this time.