Skip to content

Instantly share code, notes, and snippets.

View jverdeyen's full-sized avatar

Joeri Verdeyen jverdeyen

View GitHub Profile
@jverdeyen
jverdeyen / QueueController.php
Last active February 21, 2018 15:31
Enqueue Symfony Console commands [QueueController.php]
<?php
namespace AppBundle\Controller;
use AppBundle\Model\Queue\QueuedCommand;
use AppBundle\Service\Queue\QueuedCommandHandler;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
@jverdeyen
jverdeyen / services.yml
Created February 13, 2018 14:50
Enqueue Symfony Console commands [services.yml]
services:
AppBundle\Service\Queue\QueuedCommandHandler:
arguments:
$env: "%kernel.environment%"
AppBundle\Service\Queue\Processor\RunCommandProcessor:
arguments:
- "%kernel.project_dir%"
tags:
- { name: 'enqueue.client.processor', topicName: 'run_command' }
@jverdeyen
jverdeyen / RunCommandProcessor.php
Created February 13, 2018 14:49
Enqueue Symfony Console commands [RunCommandProcessor.php]
<?php
namespace AppBundle\Service\Queue\Processor;
use Enqueue\Client\CommandSubscriberInterface;
use Enqueue\Consumption\Result;
use Interop\Queue\PsrContext;
use Interop\Queue\PsrMessage;
use Interop\Queue\PsrProcessor;
use Symfony\Component\Process\Exception\ProcessFailedException;
@jverdeyen
jverdeyen / QueuedCommandHandler.php
Last active February 21, 2018 15:31
Enqueue Symfony Console commands [QueuedCommandHandler.php]
<?php
namespace AppBundle\Service\Queue;
use AppBundle\Model\Queue\QueuedCommand;
use Enqueue\Client\ProducerInterface;
class QueuedCommandHandler
{
/**
@jverdeyen
jverdeyen / QueuedCommand.php
Last active February 14, 2018 08:31
Enqueue Symfony Console commands [QueuedCommand.php]
<?php
namespace AppBundle\Model\Queue;
class QueuedCommand
{
/**
* @var string
*/
private $name;
@jverdeyen
jverdeyen / config.yml
Last active February 14, 2018 07:19
Enqueue Symfony Console commands [config.yml]
parameters:
persistent_cache_dir: /tmp
app_name: ProjectX
enqueue:
transport:
default: 'fs'
fs:
dsn: "file://%persistent_cache_dir%/"
path: "./enqueue" // The directory where all queue\topic files remain.
@jverdeyen
jverdeyen / QueuedCommand.php
Last active February 13, 2018 14:11
Enqueue Symfony Console commands
<?php
namespace AppBundle\Model\Queue;
class QueuedCommand
{
/**
* @var string
*/
private $name;
root = true
[*]
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
[*.{php,yml,sh,feature}]
indent_style = space
@jverdeyen
jverdeyen / .docker-alias.bash
Created August 9, 2016 08:07
A set of docker aliases
# ------------------------------------
# Docker alias and function
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get container process
alias dps="docker ps"
@jverdeyen
jverdeyen / .php_cs.php
Last active February 26, 2019 07:17
A default php-cs configuration
<?php
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'concat_with_spaces',
'multiline_spaces_before_semicolon',
'short_array_syntax',
'newline_after_open_tag',
'single_quote',