Skip to content

jthatch/advent-of-code-2022-php

Repository files navigation

Advent of Code 2022 PHP

The solutions to advent of code 2022, solved using PHP 8.2. By James Thatcher

Solutions 🥳🎉

🎄 Day 1 🎅 Day 2 ☃️ Day 3 🦌 Day 4 🍪 Day 5 🥛 Day 6 🧦 Day 7 🎁 Day 8Day 9 🛐 Day 10Day 11 🧝 Day 12 🎄 Day 13

About

My attempts at tacking the awesome challenges at Advent of Code 2022 using PHP 8.2.

day runner in action

Commands

Note: checkout the code then run make run. The docker and composer libraries will auto install.

Solve all days puzzles
make run

Solve an individual days puzzles
make run day={N} e.g. make run day=13

Solve multiple days puzzles
make run day={N},{N1}-{N2}... e.g. make run day=1-5,7,10,10,10 Runs days 1-5, 7 and 10 3 times

Solve a single part of a days puzzles
make run day={N} part={N} e.g. make run day=16 part=2

Create the next days PHP file and download puzzle from server
Auto detects what current Day you are on and will create the next (only if the files don't exist)

make next
# Created new file: src/Days/Day8.php
# Fetching latest input using day=8 AOC_COOKIE=53616c7465645f5f539435aCL1P
# ./input/day8.txt downloaded

Use XDebug
make xdebug

Xdebug can also be triggered on a single days and/or part
make xdebug day={N} e.g. make xdebug day=13 or make xdebug day=13 part=2

IDE settings:

  • 10000 - xdebug port
  • aoc-2021 - PHP_IDE_CONFIG (what you put in PHPStorm -> settings -> debug -> server -> name)
  • /app - absolute path on the server
  • see xdebug.ini if you're stuck