Download the PHP package pavelsterba/advent-of-code without Composer
On this page you can find all versions of the php package pavelsterba/advent-of-code. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pavelsterba/advent-of-code
More information about pavelsterba/advent-of-code
Files in pavelsterba/advent-of-code
Package advent-of-code
Short Description Library and application for better Advent of Code experience.
License MIT
Informations about the package advent-of-code
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. If you want to solve it in PHP, this library can help you with common tasks as input downloading or solutions running.
Installation & Setup
At first, install AdventOfCode for PHP as dependency via composer:
It will add CLI located in vendor/bin/aoc
. With it, you can configure it with:
How to find my session cookie
One important think you need is value of your session cookie when you are logged in on Advent of Code website. Some small differences may exists between different browser, but basic way to find it is:
- Go to Advent of Code website.
- Make sure you are logged in.
- Open Developer Tools with
F12
. - Go to
Application
tab. - In left menu, click on
Cookies
item and select Advent of Code domain. - Find cookie with name
session
and copy its value.
Value of this cookie is sensitive information! Make sure it will not be commited publicly, so add .env
(where is it stored in your computer) into .gitignore
.
CLI commands
dotenv
Generate .env file during setup.
input
Download input data for given day. It also creates boilerplate code for your solutions (more about it later).
run
Run solutions from generated boilerplate.
Solutions
If you download input data with CLI and generate boilerplate, you will see that this library created some folder and files:
input.txt
contains input data for your puzzle.
input-test.txt
is by default empty file, but its purpose is to add example input data for puzzle to be able to run your solution against small dataset with expected output.
solution.php
is main file for your solutions. It contains two method - first()
and second()
for easier and harder part of puzzle. Just return
your solution value and run it.
All versions of advent-of-code with dependencies
symfony/dotenv Version ^6.2
composer-runtime-api Version ^2.2
nette/php-generator Version ^4.0