migueabellan / aoc
Advent Of Code - Library PHP
dev-master
2021-12-27 13:00 UTC
Requires
- php: ^8.1
- ext-ctype: *
- ext-iconv: *
- guzzlehttp/guzzle: ^7.2
- symfony/console: ^6.0
- symfony/dotenv: ^6.0
Requires (Dev)
- phpstan/extension-installer: ^1.1
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-04-27 18:04:34 UTC
README
Table of Contents
Installation
composer require migueabellan/aoc
Basic Usage
Create a .env.local
file to make environment variables.
# DO NOT COMMITTED THIS FILE
SESSION_AOC=your_cookie_session
Autoloading
Supports PSR-4
autoloaders.
<?php // When installed via composer require_once 'vendor/autoload.php'; use Aoc\Client; $client = new Client(); // Retrieve input by year and day $input = $client->getInputBy(2020, 23); echo $input; // 543769257...
Advanced Usage
<?php use Aoc\Puzzle\AbstractPuzzle; class Puzzle extends AbstractPuzzle { public function exec1(array $input = []): int|string { $result = 0; // ... return (string)$result; } public function exec2(array $input = []): int|string { $result = 0; // ... return (string)$result; } }
Utils
<?php use Aoc\Utils; $array = [0, 1, 2]; $permutations = ArrayUtil::permutations($array); print_r($permutations); // [[0, 1, 2], [0, 2, 1], [2, 1, 0] ...]