PHPackages                             pavelsterba/advent-of-code - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pavelsterba/advent-of-code

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pavelsterba/advent-of-code
==========================

Library and application for better Advent of Code experience.

0.5(3y ago)4281[1 issues](https://github.com/pavelsterba/advent-of-code/issues)[1 PRs](https://github.com/pavelsterba/advent-of-code/pulls)MITPHP

Since Dec 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/pavelsterba/advent-of-code)[ Packagist](https://packagist.org/packages/pavelsterba/advent-of-code)[ RSS](/packages/pavelsterba-advent-of-code/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (6)Used By (0)

[Advent of Code](https://adventofcode.com/) 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 &amp; Setup
------------------------

[](#installation--setup)

At first, install **AdventOfCode** for PHP as dependency via composer:

```
composer require pavelsterba/advent-of-code

```

It will add CLI located in `vendor/bin/aoc`. With it, you can configure it with:

```
php vendor/bin/aoc dotenv

```

### How to find my session cookie

[](#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:

1. Go to [Advent of Code website](https://adventofcode.com/).
2. Make sure you are logged in.
3. Open Developer Tools with `F12`.
4. Go to `Application` tab.
5. In left menu, click on `Cookies` item and select Advent of Code domain.
6. 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
------------

[](#cli-commands)

### dotenv

[](#dotenv)

```
php vendor/bin/aoc dotenv [options]

```

```
Options:
  -y, --year=YEAR        Which year should be added as current
  -s, --session=SESSION  Session token for Advent of Code

```

Generate .env file during setup.

### input

[](#input)

```
php vendor/bin/aoc input [options] [--]

```

```
Arguments:
  day                                 Which day to download

Options:
  -y, --year=YEAR                     Which year should be downloaded
  -f, --force                         Download input without cache

```

Download input data for given day. It also creates boilerplate code for your solutions (more about it later).

### run

[](#run)

```
php vendor/bin/aoc run [options] [--]

```

```
Arguments:
  day                   Which day to run

Options:
  -y, --year=YEAR       Which year are you solving
  -f, --first           Run first solution
  -s, --second          Run second solution
  -t, --test            Run on test data

```

Run solutions from generated boilerplate.

Solutions
---------

[](#solutions)

If you download input data with CLI and generate boilerplate, you will see that this library created some folder and files:

```
2022
└─ day-1
   ├─ intput.txt
   ├─ intput-test.txt
   └─ solution.php

```

`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.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

1247d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/61f7240335c7188c102d371409cf95d12914b36c3742162bdac1857081c1f681?d=identicon)[pavelsterba](/maintainers/pavelsterba)

---

Top Contributors

[![pavelsterba](https://avatars.githubusercontent.com/u/6181620?v=4)](https://github.com/pavelsterba "pavelsterba (24 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pavelsterba-advent-of-code/health.svg)

```
[![Health](https://phpackages.com/badges/pavelsterba-advent-of-code/health.svg)](https://phpackages.com/packages/pavelsterba-advent-of-code)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M16](/packages/vaimo-composer-patches)[ramsey/conventional-commits

A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

1931.2M122](/packages/ramsey-conventional-commits)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
