Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am gunnarlium on github.
  • I am gunnarlium ( on keybase.
  • I have a public key ASDVYc_KW1M2rBQhbI1dAsPyCQ-Sb1CevXPL5Xoh_XD9fAo

To claim this, I am signing this object:

gunnarlium / guzzle-retry.php
Created Dec 17, 2015
Example of how to create a retry subscriber for Guzzle 6
View guzzle-retry.php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Request as Psr7Request;
use GuzzleHttp\Psr7\Response as Psr7Response;
use Psr\Log\LoggerInterface;
const MAX_RETRIES = 2;
View ArrayToStringTransformer.php
namespace App\Form\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
class ArrayToStringTransformer implements DataTransformerInterface
public function transform($value)
gunnarlium / JsonErrorHandler.php
Last active Sep 20, 2018
Exmple JsonErrorHandler for Silex (or any other app implementing HttpKernel)
View JsonErrorHandler.php
namespace Aptoma;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
* JsonErrorHandler is able to capture exceptions and do smart stuff with them.
gunnarlium / CorsEventSubscriber.php
Created Jun 21, 2013
Example of how to add CORS support in Silex, based on
View CorsEventSubscriber.php
namespace App\Event;
use Nelmio\CorsBundle\EventListener\CorsListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
class CorsEventSubscriber extends CorsListener implements EventSubscriberInterface
gunnarlium / composer.json
Created May 10, 2013
Guzzle\Log\MessageFormatter issue. Check output in guzzle.log.
View composer.json
"require": {
"guzzle/guzzle": "3.4.1",
"monolog/monolog": "~1.5"