miuqueabellan / aoc
Advent Of Code - 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-09-27 18:46:39 UTC
README
目录
安装
composer require migueabellan/aoc
基本用法
创建一个.env.local
文件来设置环境变量。
# DO NOT COMMITTED THIS FILE
SESSION_AOC=your_cookie_session
自动加载
支持PSR-4
自动加载器。
<?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...
高级用法
<?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; } }
工具
<?php use Aoc\Utils; $array = [0, 1, 2]; $permutations = ArrayUtil::permutations($array); print_r($permutations); // [[0, 1, 2], [0, 2, 1], [2, 1, 0] ...]