cobaltgrid/airac-calculator
Composer 安装命令:
composer require cobaltgrid/airac-calculator
包简介
PHP library for AIRAC date information
README 文档
README
airac-calculator is a zero dependency PHP library for parsing and computing AIRAC (Aeronautical Information Regulation And Control) cycles.
AIRAC cycles are used in the aviation industry to standardise significant revisions to operational information, such as aeronautical charts, frequencies, procedures and more. Each cycle lasts of 28 days, with 13 cycles per year (or exceptionally 14 in some cases). Cycles have two key, unique, properties; the date it becomes effective and a 4 digit cycle code.
This package has been validated against the EUROCONTROL AIRAC dates database.
Requirements
- PHP 8.1 and above (tested up to PHP 8.3)
License
airac-calculator is licensed under the MIT license, which can be found in the root of the package in the LICENSE file.
Installation
The easiest way to install is via composer:
$ composer require cobaltgrid/airac-calculator
Usage
If you are using Composer:
<?php // Include the composer autoloader require('../vendor/autoload.php'); // Import the class use CobaltGrid\AIRACCalculator\AIRACCycle;
All functions are performed on the AIRACCycle class. Documentation for available methods is given below.
Creating a cycle
// Getting the AIRAC cycle effective at a specific date AIRACCycle::forDate(new DateTime('2023-07-29')); // Getting the AIRAC cycle from an **exact** effective date AIRACCycle::fromEffectiveDate(new DateTime('2023-07-13')); // Getting the AIRAC cycle from a cycle code AIRACCycle::fromCycleCode('2308'); // Getting from a serial (a serial is the number of cycles since the AIRAC epoch) AIRACCycle::fromSerial(1619); // Getting the current effective AIRAC AIRACCycle::current(); // Getting the next AIRAC to become effective AIRACCycle::next(); // Getting the previous AIRAC AIRACCycle::previous();
Getting cycle information
$cycle = AIRACCycle::current(); // Get the 4-digit AIRAC cycle code (string) $cycle->getCycleCode(); // 2308 // Gets the number of the cycle in it's year, starting at 1 (i.e. the first cycle is ordinal 1, second is 2, etc.) (int) $cycle->getOrdinal(); // 1 // Returns the date the cycle became/becomes effective (DateTime) $cycle->getEffectiveDate(); // DateTime Instance // Returns the serial (number of cycles since AIRAC epoch) (int) $cycle->getSerial(); // 1619 // Returns the next cycle from this one (AIRACCycle) $cycle->nextCycle(); // AIRACCycle Instance // Returns the previous cycle from this one (AIRACCycle) $cycle->previousCycle(); // AIRACCycle Instance
Testing
The code base is tested with PHP unit:
$ ./vendor/bin/phpunit
cobaltgrid/airac-calculator 适用场景与选型建议
cobaltgrid/airac-calculator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.74k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2019 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cobaltgrid/airac-calculator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cobaltgrid/airac-calculator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.74k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-30