Code snippets

You will find here 5 code snippets I find useful so I don't have to Google ™ or Stackoverflow ™ them when I need. There are also code snippets I always forget! 😁 Sometimes, related links to the code will be available. The main difference with other random snippets you will find on the web is that in most cases (for the Symfony related ones) you will be able to run them directly from this website to check the output so you can verify it works as expected ™.

In this snippet, we see how to test the current PHP version. The most straightforward way is to use the PHP_VERSION_ID constant. I...

PHP

Published on 2021-11-19 • Modified on 2021-11-19

 View the code


This snippet shows how to use a stable version of a package, whatever the major version with composer. We generally use major requ...

composer

Published on 2021-10-03 • Modified on 2021-10-03

 View the code


In this snippet, we see how to use a specific branch instead of a version with composer. Sometimes, this can be useful for testing...

composer

Published on 2021-10-02 • Modified on 2021-10-02

 View the code


This snippet shows how to initialize a Symfony sandbox with a given version, thanks to the Symfony binary. You have to use the --v...

Symfony

Published on 2021-09-17 • Modified on 2021-09-17

 View the code


This is a small trick that allows the jsdelivr.net CDN network. It's a very bad practice to use the "last" stable available versio...

Vue.js

Published on 2020-01-23 • Modified on 2020-01-23

 View the code