rubin/opensky 问题修复 & 功能扩展

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

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

rubin/opensky

最新稳定版本:1.0.2

Composer 安装命令:

composer require rubin/opensky

包简介

OpenSky REST API connector

README 文档

README

Build Status Latest Stable Version Coverage Status PHP Version Require

PHP implementation for the OpenSky Network REST API. This library is based on the REST API docs.

Installation

With composer:

composer require rubin/opensky

Usage

Create API connector:

$openSkyApi = new \OpenSky\OpenSkyApi();

Set credentials (optional):

$openSkyApi->setCredentials('{username}', '{password}');

Refer to the limitations, to see why/when a user account would be preferred.

Examples

Example query with time and aircraft: https://opensky-network.org/api/states/all?time=1458564121&icao24=3c6444

echo "ICAO\tLongitude\tLatitude\n";
foreach ($openSkyApi->getStatesAll(time: 1458564121, icao24: '3c6444')->getStates() as $state) {
    printf(
        "%s\t%f\t%f\n",
        $state->getIcao24(),
        $state->getLongitude(),
        $state->getLatitude()
    );
}

Example query with bounding box covering Switzerland: https://opensky-network.org/api/states/all?lamin=45.8389&lomin=5.9962&lamax=47.8229&lomax=10.5226

echo "ICAO\tLongitude\tLatitude\n";
foreach ($openSkyApi->getStatesAll(bBox: new \OpenSky\BoundingBox(45.8389, 47.8229, 5.9962, 10.5226))->getStates() as $state) {
    printf(
        "%s\t%f\t%f\n",
        $state->getIcao24(),
        $state->getLongitude(),
        $state->getLatitude()
    );
}

Retrieve states of two particular airplanes: https://opensky-network.org/api/states/all?icao24=3c6444&icao24=3e1bf9

echo "ICAO\tLongitude\tLatitude\n";
foreach ($openSkyApi->getStatesAll(icao24: ['3c6444', '3e1bf9'])->getStates() as $state) {
    printf(
        "%s\t%f\t%f\n",
        $state->getIcao24(),
        $state->getLongitude(),
        $state->getLatitude()
    );
}

Get flights from 12pm to 1pm on Jan 29 2018: https://opensky-network.org/api/flights/all?begin=1517227200&end=1517230800

echo "ICAO\tDep  - Arr\n";
foreach ($openSkyApi->getFlightsAll(begin: 1517227200, end: 1517230800)->getFlights() as $flight) {
    printf(
        "%s\t%s - %s\n",
        $flight->getIcao24(),
        $flight->getEstDepartureAirport() ?: '----',
        $flight->getEstArrivalAirport() ?: '----'
    );
}

Get flights for D-AIZZ (3c675a) on Jan 29 2018: https://opensky-network.org/api/flights/aircraft?icao24=3c675a&begin=1517184000&end=1517270400

echo "ICAO\tDep  - Arr\n";
foreach ($openSkyApi->getFlightsAircraft(icao24: '3c675a', begin: 1517227200, end: 1517230800)->getFlights() as $flight) {
    printf(
        "%s\t%s - %s\n",
        $flight->getIcao24(),
        $flight->getEstDepartureAirport() ?: '----',
        $flight->getEstArrivalAirport() ?: '----'
    );
}

Get all flights arriving at Frankfurt International Airport (EDDF) from 12pm to 1pm on Jan 29 2018: https://opensky-network.org/api/flights/arrival?airport=EDDF&begin=1517227200&end=1517230800

echo "ICAO\tDep  - Arr\n";
foreach ($openSkyApi->getFlightsArrival(airport: 'EDDF', begin: 1517227200, end: 1517230800)->getFlights() as $flight) {
    printf(
        "%s\t%s - %s\n",
        $flight->getIcao24(),
        $flight->getEstDepartureAirport() ?: '----',
        $flight->getEstArrivalAirport() ?: '----'
    );
}

Get all flights departing at Frankfurt International Airport (EDDF) from 12pm to 1pm on Jan 29 2018: https://opensky-network.org/api/flights/departure?airport=EDDF&begin=1517227200&end=1517230800

echo "ICAO\tDep  - Arr\n";
foreach ($openSkyApi->getFlightsDeparture(airport: 'EDDF', begin: 1517227200, end: 1517230800)->getFlights() as $flight) {
    printf(
        "%s\t%s - %s\n",
        $flight->getIcao24(),
        $flight->getEstDepartureAirport() ?: '----',
        $flight->getEstArrivalAirport() ?: '----'
    );
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-06-26