lookyman/flightradar24 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lookyman/flightradar24

Composer 安装命令:

composer require lookyman/flightradar24

包简介

PHP SDK for the Flightradar24 API.

README 文档

README

PHP SDK for the Flightradar24 API, built on PSR-18. Bring your own PSR-18 HTTP client and PSR-17 request factory; all API responses are mapped into immutable readonly DTOs.

Requirements

  • PHP 8.5+
  • A Flightradar24 API token
  • Any PSR-18 HTTP client and PSR-17 request factory (e.g. guzzlehttp/guzzle, or symfony/http-client + nyholm/psr7)

Installation

composer require lookyman/flightradar24
# plus an HTTP client + factory, for example:
composer require guzzlehttp/guzzle guzzlehttp/psr7

Authentication

A token is required — there is no environment-variable fallback. Pass it to the Transport constructor. A blank token throws Lookyman\Flightradar24\Exception\MissingApiTokenException.

Usage

use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory;
use Lookyman\Flightradar24\Client;
use Lookyman\Flightradar24\Query\Boundary;
use Lookyman\Flightradar24\Query\FlightPositionsQuery;
use Lookyman\Flightradar24\Transport\Transport;

$client = new Client(new Transport($token, new GuzzleClient(), new HttpFactory()));

// Single object:
$airport = $client->airports->getFull('WAW');
echo $airport->name; // "Warsaw Chopin"

// List:
$positions = $client->livePositions->getLight(new FlightPositionsQuery(
    new Boundary(52.5, 52.0, 20.8, 21.3),
));
printf("Found %d aircraft.\n", count($positions));

Every call is synchronous and returns the DTO (or list<Dto>) directly. See examples/basic_usage.php.

Endpoint coverage

Resource method HTTP request
livePositions->getLight(FlightPositionsQuery)list<FlightPositionLight> GET /api/live/flight-positions/light
livePositions->getFull(FlightPositionsQuery)list<FlightPositionFull> GET /api/live/flight-positions/full
livePositions->getCount(FlightPositionsQuery)CountResult GET /api/live/flight-positions/count
airports->getLight(string $code)AirportLight GET /api/static/airports/{code}/light
airports->getFull(string $code)AirportFull GET /api/static/airports/{code}/full
airlines->getLight(string $icao)AirlineLight GET /api/static/airlines/{icao}/light
usage->get(UsagePeriod = P24H)list<UsageLogSummary> GET /api/usage
historic->positions->getLight/getFull/getCount(HistoricFlightPositionsQuery) GET /api/historic/flight-positions/{light,full,count}
historic->events->getLight/getFull(FlightEventsQuery) GET /api/historic/flight-events/{light,full}
flightSummary->getLight/getFull/getCount(FlightSummaryQuery) GET /api/flight-summary/{light,full,count}
flightTracks->get(string $flightId)list<FlightTracks> GET /api/flight-tracks

Query value objects

  • FlightPositionsQuery — all live-position filters (bounds, callsigns, categories, altitudeRanges, gspeed, limit, …); serialises to the API's CSV query format.
  • Boundarynorth, south, west, east; validates latitude/longitude ranges and north > south.
  • AltitudeRangeminAltitude, maxAltitude.
  • HistoricFlightPositionsQuery — like FlightPositionsQuery plus a required timestamp (int unix seconds or \DateTimeInterface).
  • FlightSummaryQuery — flight filters plus flightDatetimeFrom/flightDatetimeTo (string|\DateTimeInterface), sort, limit.
  • FlightEventsQuery — required flightIds and eventTypes (FlightEventType|string).
  • Enums: UsagePeriod (24h, 7d, 30d, 1y), FlightCategory (service-type codes), FlightEventType (takeoff, landed, …).

Error handling

Fr24Exception (extends \RuntimeException)
├── MissingApiTokenException   blank API token passed to the Transport constructor
├── TransportException         PSR-18 client failure (network/timeout) or JSON decode error
└── ApiException               non-2xx response
    ├── BadRequestException        400
    ├── AuthenticationException    401
    ├── PaymentRequiredException   402
    ├── NotFoundException          404
    └── RateLimitException         429

Any unmapped 4xx/5xx status surfaces as the base ApiException, which exposes the PSR-7 response:

use Lookyman\Flightradar24\Exception\ApiException;

try {
    $airport = $client->airports->getFull('ZZZ');
} catch (ApiException $e) {
    $status = $e->response->getStatusCode();
    $body = json_decode((string) $e->response->getBody(), true);
}

License

MIT. See LICENSE.

lookyman/flightradar24 适用场景与选型建议

lookyman/flightradar24 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 06 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 lookyman/flightradar24 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lookyman/flightradar24 我们能提供哪些服务?
定制开发 / 二次开发

基于 lookyman/flightradar24 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-06