Advent of code 2021/15
Ajax Direct

Answer

Part 1 :
Part 2 :
function dijkstra($grid) {
    return (new Graph(fn ($graph) =>
        $grid->getNeighbors(explode(";", $graph->current))->filter()->map("int")
    ))->explore("0;0", ($grid->width()-1).";".($grid->height()-1))[1];
}

// ==================================================
// > PART 1
// ==================================================
$grid = grid($input);
$solution_1 = dijkstra($grid);

// ==================================================
// > PART 2
// ==================================================
[$w, $h] = [$grid->width(), $grid->height()];

$solution_2 = dijkstra(
    $grid->repeatX(5)->repeatY(5)->map(function ($c, $xy) use ($w, $h) {
        $int = (int($c) + floor($xy[0] / $w) + floor($xy[1] / $h));
        return $int > 9 ? $int - 9 : $int;
    })
);