Skip to content

Instantly share code, notes, and snippets.

View lyrixx's full-sized avatar
😀

Grégoire Pineau lyrixx

😀
View GitHub Profile
@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active April 19, 2024 13:47
Hardcore Debug Logger
<?php
const STREAM_OPEN_FOR_INCLUDE = 128;
final class HardCoreDebugLogger
{
public static function register(string $output = 'php://stdout')
{
register_tick_function(function () use ($output) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
@lyrixx
lyrixx / README.md
Last active April 11, 2024 21:52
slugger CLI

Slugger

This "project" is a simple CLI slugger

image

@lyrixx
lyrixx / LogMiddleware.php
Last active March 13, 2024 08:11
UUID processor for symfony
<?php
namespace App\Middleware;
use App\Middleware\Stamp\LogStamp;
use App\Monolog\Processor\UuidProcessor;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
use Symfony\Component\Messenger\Middleware\StackInterface;
@lyrixx
lyrixx / CHANGELOG-3.0.md
Last active February 23, 2024 14:36
Symfony CHANGELOG

Bridge/Doctrine

  • removed EntityChoiceList
  • removed $manager (2nd) and $class (3th) arguments of ORMQueryBuilderLoader
  • removed passing a query builder closure to ORMQueryBuilderLoader
  • removed loader and property options of the DoctrineType

Bridge/Monolog

  • deprecated interface Symfony\Component\HttpKernel\Log\LoggerInterface has been removed
@lyrixx
lyrixx / index.php
Last active February 19, 2024 06:37
How to call private command method in Symfony ?
#!/usr/bin/env php
<?php
require __DIR__ . '/../../vendor/autoload.php';
use Castor\Console\Command\CompileCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
// We extends the CompileCommand, to be able to remove the constructor, because
@lyrixx
lyrixx / test.php
Last active November 10, 2023 14:27
Symfony Playgound with its Container and a custom configuration
<?php
use App\Kernel;
require __DIR__.'/vendor/autoload_runtime.php';
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@lyrixx
lyrixx / run.php
Last active November 9, 2023 13:51
Updated your templates with the new twig include
<?php
<<<CONFIG
packages:
- "symfony/finder: ~3.0"
- "symfony/console: ~3.0"
CONFIG;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@lyrixx
lyrixx / ContainerTest.php
Last active August 31, 2023 07:32
Test applications services can boot
<?php
namespace Tests\Integration;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@lyrixx
lyrixx / segfault-finder.php
Last active August 15, 2023 21:17
How to find a segfault in PHP
<?php
register_tick_function(function() {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$last = reset($bt);
$info = sprintf("%s +%d\n", $last['file'], $last['line']);
file_put_contents('/tmp/segfault.txt', $info, FILE_APPEND);
// or
// file_put_contents('php://output', $info, FILE_APPEND);
});
@lyrixx
lyrixx / barcode.php
Created November 20, 2015 18:42
Barcode
<?php
<<<CONFIG
packages:
- "zendframework/zend-barcode: ^2.5"
- "symfony/console: ^2.7"
CONFIG;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Helper\QuestionHelper;