Skip to content

Instantly share code, notes, and snippets.

View michael-lurquin's full-sized avatar
🏠
Working from home

LURQUIN Michaël michael-lurquin

🏠
Working from home
View GitHub Profile
@Grafikart
Grafikart / AppServiceProvider.php
Created August 25, 2022 08:07
Laravel SQL Log
<?php
// Ajouter ce code dans boot()
if ($this->app->isLocal() && ($_SERVER['PHP_SELF'] ?? null) !== 'artisan') {
$k = 0;
\Illuminate\Support\Facades\DB::listen(function (\Illuminate\Database\Events\QueryExecuted $q) use (&$k) {
$k++;
file_put_contents('php://stdout', "[{$k}] \e[34m{$q->sql}\t\e[37m]".json_encode($q->bindings)."\t\e[32m{$q->time}ms\e[0m\n");
});
}
@levelsio
levelsio / git_graph.php
Last active June 5, 2023 03:49
GitHub style graph in PHP + CSS
<style>
.git-graph {
text-align: left;
line-height: 1;
}
.git-graph-row {
clear: both;
text-align: left;
}
.git-graph-cell {