New nostalgic Advent of Code in PHP! I worked in PHP for many years, so this time I want to remind those days to myself. To see the original tasks for all days and previous years, visit https://adventofcode.com/. All credits to them for this nice work!
- Year 2019 in Elixir: https://github.com/arxeiss/advent-of-code-2019
- Year 2020 in Go: https://github.com/arxeiss/advent-of-code-2020
- Year 2021 in PHP: https://github.com/arxeiss/advent-of-code-2021
See each day for more information. I copied the instructions there as well.
- Install PHP 8.1+ and Composer https://getcomposer.org/download/
- Clone this repo
- Install dependencies with
php composer install - Run:
php start.phpto execute runnerphp vendor/bin/phpunitto start testsphp vendor/bin/phpcsto run linter
If you don't want to install PHP locally, I suggest to use ./php bash script which will execute it in PHP docker.
To download Composer locally use this
wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
./php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
./php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
./php composer-setup.php
./php -r "unlink('composer-setup.php'); unlink('installer.sig');"If you have problem with
./php composer-setup.phpremove from./phptemporarily the part--user "$(id -u):$(id -g)"
Then it remains the same, just use ./php instead of php
- Day 1: Calorie Counting
- Day 2: Rock Paper Scissors
- Day 3: Rucksack Reorganization
- Day 4: Camp Cleanup
- Day 5: Supply Stacks
- Day 6: Tuning Trouble
- Day 7: No Space Left On Device
- Day 8: Treetop Tree House
- Day 9: Rope Bridge
- Day 10: Cathode-Ray Tube
- Day 11: Monkey in the Middle
- Day 12: Hill Climbing Algorithm
End of story for this year. Now I have to reserve a time for a baby 👶 too. So no more days.