Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 2.28 KB

README.md

File metadata and controls

56 lines (42 loc) · 2.28 KB

Advent Of Code 2022 in PHP

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!

See each day for more information. I copied the instructions there as well.

How to run

  1. Install PHP 8.1+ and Composer https://getcomposer.org/download/
  2. Clone this repo
  3. Install dependencies with php composer install
  4. Run:
    • php start.php to execute runner
    • php vendor/bin/phpunit to start tests
    • php vendor/bin/phpcs to run linter

Running with Docker

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.php remove from ./php temporarily the part --user "$(id -u):$(id -g)"

Then it remains the same, just use ./php instead of php

Days I got stuck and searched for the help

Days

End of story for this year. Now I have to reserve a time for a baby 👶 too. So no more days.