Skip to content

Instantly share code, notes, and snippets.

View MarioBlazek's full-sized avatar
🎯
Focusing

Mario Blazek MarioBlazek

🎯
Focusing
View GitHub Profile
<?php
namespace AppBundle\Integration\TheCatApi;
use AppBundle\Integration\TheCatApi\Value\TheCatApiValue;
use eZ\Publish\Core\MVC\ConfigResolverInterface;
use Http\Client\HttpClient;
use Http\Message\MessageFactory;
use Psr\Http\Message\RequestInterface;
use Symfony\Component\HttpFoundation\Request;
@MarioBlazek
MarioBlazek / gist:1efbe6ac58a6adf108480233d38d9fe8
Created March 29, 2020 14:43
varnish_6_vcl_for_media_site
// Varnish VCL for:
// - Varnish 5.1 or higher (6.0LTS recommended, and is what we mainly test against)
// - Varnish xkey vmod (via varnish-modules package 0.10.2 or higher, or via Varnish Plus)
// - eZ Platform 2.5LTS or higher with ezplatform-http-cache (this) bundle
//
// Make sure to at least adjust default parameters.yml, defaults there reflect our testing needs with docker.
vcl 4.1;
import std;
import xkey;
# Httplug configuration
httplug:
plugins:
logger: ~
clients:
app:
factory: httplug.factory.guzzle6
plugins: [httplug.plugin.logger]
second:
factory: httplug.factory.curl
composer require "php-http/guzzle6-adapter:~1.0"
new Http\HttplugBundle\HttplugBundle()
@MarioBlazek
MarioBlazek / gist:fbd36f452850b282d75ecbdc6cbbfb6c
Created February 14, 2020 12:16
HTTPlug install procedure
composer require "php-http/httplug-bundle:^1.15.2" "php-http/curl-client:^1.7.1"
# Httplug configuration
httplug:
plugins:
logger: ~
clients:
app:
factory: httplug.factory.guzzle6
plugins: [httplug.plugin.logger]
@MarioBlazek
MarioBlazek / full.html.twig
Created February 6, 2020 13:14
app/Resources/views/themes/standard/default/content
{% extends '@ezdesign/pagelayout.html.twig' %}
{% block content %}
<h1>TheCatAPI - Cats as a Service, Everyday is Caturday.</h1>
<h3>Available categories</h3>
{% if categories|length > 0 %}
<ul>
{% for category in categories %}
ezpublish:
system:
site_group:
content_view:
full:
main_page:
template: '@ezdesign/default/content/full.html.twig'
controller: 'app.controller.cat_api'
match:
Id\Location: 2
<?php
declare(strict_types=1);
namespace AppBundle\Controller;
use AppBundle\Http\CatApiClient;
use eZ\Publish\Core\MVC\Symfony\Controller\Controller;
use eZ\Publish\Core\MVC\Symfony\View\ContentView;