Skip to content

Instantly share code, notes, and snippets.

View Jibbarth's full-sized avatar

Jibé Barth Jibbarth

View GitHub Profile
Jibbarth / HttpProblemNormalizer.php
Created April 10, 2024 14:03
Exception normalizer : Allow to have message of exception
namespace App\Normalizer;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
Jibbarth /
Created December 9, 2023 11:38
[Sylius] Get ready to add a behat feature that use javascript

While contributing on Sylius, I had to add a test for a fix.

There was already some behat test regarding the feature, but I had trouble to get ready to launch them in my own environment, and Makefile provided by Sylius didn't help me.

Here is how I proceed.

1. Launching Sylius in test mode

First, you need to be able to launch the sylius, but in Test mode.

Jibbarth / ResolveTargetEntityListenerDecorator.php
Created August 27, 2023 15:06
[DOCTRINE] Automatically remove mappedSuperClass when resolveTargetEntity target the root model
namespace App\Doctrine;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Tools\ResolveTargetEntityListener;
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
Jibbarth / NoValidateFixerConfigurationResolver.php
Created February 12, 2023 11:37
[PHP-CS-Fixer] Configure any rule with except paths
namespace App\Fixer;
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface;
final class NoValidateFixerConfigurationResolver implements FixerConfigurationResolverInterface
Jibbarth /
Last active May 10, 2021 16:38
[Sylius] Restrict Payment Methods depending on customer group

It could be common to display some payment methods only to customers that belong to a group.

For example, you can add an offline payment method for you B2B customers, and invoice them at the end of the month, and this offline payment should absolutely not be available for other customer! Let's see how to integrate this in a Sylius Application.

1. The Quick and Dirty way

The form displaying payment methods in Sylius retrieve them from the service sylius.payment_methods_resolver.

Let's decorate it !

Jibbarth /
Last active December 10, 2020 20:00
[Sylius] Test all admin menu links 🦢
Jibbarth /
Last active May 2, 2020 14:46
🇫🇷 Gnome / Chrome / Dark mode

Sur GNOME, j'ai ajouté l'extension DayNight qui permet de passer d'un theme sombre a light d'un clic.

Contrairement a Firefox, chrome ne prend pas en compte le theme mode de l'utilisateur à la volée.

Chrome n'interprete pas le color-prefers-scheme correctement, même si le theme est configuré sur Dark.

Pour lancer chrome en mode dark,

  google-chrome-stable --force-dark-mode
Jibbarth /
Last active September 23, 2021 14:57
⚡Recreate Github CLI OAuth feature in a Symfony command ⚡

⚡Recreate Github CLI OAuth feature in a Symfony command ⚡

Github recently released a CLI tool to manage issues and PR directly from your terminal. As I work on some open source projects, I downloaded it to give a try.

And at first launch, the CLI ask to connect by using OAuth. It propose to press "Enter" to open in my browser, and catch correctly the access_token.

That .. blown my mind 🤯 I didn't expect we can connect through terminal like this. So, as it's open source, I dived into the code source.

Jibbarth / Managing personal and work git
Last active May 3, 2020 15:12
Automatically managing personal and work git email

In order to differentiate your professional and personal email address when working on git repositories, here is how I proceeded.

1. Create a global git hooks folder

Create a folder where you will drop the hooks that should apply to each repository. And set the core.hooksPath on this folder

git config --global core.hooksPath /path/to/my/centralized/hooks
Jibbarth /
Last active April 11, 2024 08:51
Composering a PrestaShop

Note : This is a guide for PS 1.6.x because 1.7 provide a composer.json

How to use composer in PrestaShop

The PHP World is full of talentued developers. They create very usefull and powerfull libraries. In PrestaShop, developers often have to reimplement them. Unless use composer !

Init a composer

First, you have to install composer to your system. I don't teach you how to do this, read the doc.