定制 cbzink/launchlibrary 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cbzink/launchlibrary

最新稳定版本:v1.0.1

Composer 安装命令:

composer require cbzink/launchlibrary

包简介

An unofficial SDK for Launch Library 2.

README 文档

README

Build Status Latest Stable Version Total Downloads License

A simple SDK for interacting with the Launch Library 2 API.

Table of Contents

View the table of contents.

Requirements

  • PHP >= 7.4
  • A LL2 API token (Optional)

Installation

Install this library via Composer.

composer require cbzink/launchlibrary

Usage

Setup

Instantiate an instance of the LL2 class

use cbzink\LaunchLibrary\LL2;

$client = new LL2($apiToken, $apiEndpoint);

Pagination limits

You can change the pagination limit (default 10) using setPaginationLimit.

$client->setPaginationLimit(30);

$client->getPaginationLimit() // (int) 30

Resources

Currently available resources include Agencies, Astronauts, Docking Events, Events, Expeditions, Launchers, Launches, Locations, Pads, Space Stations, and Spacecraft.

Searching for resources

You can search for resources using the parameters specified in the LL2 API docs.

$results = $client->agencies()->search([
    'country_code' => 'US',
]);

Pagination

Searches are often paginated. An array of resources is available under the results property, and next() and previous() methods are available for moving through pagination.

$agencies = $client->agencies()->search();

// Array of Agency resources.
$resources = $agencies->results;

// Fetch the next page of results
$agencies = $agencies->next();

Retrieving resources

You can retrieve detailed resources by their ID.

$results = $client->agencies()->fetch(123);

Special cases

Events and Launches

Events and Launches have additional Previous and Upcoming endpoints you can access using the SDK. search() and fetch() are available on both.

// Previous
$results = $client->events()->previous()->search();

// Upcoming
$results = $client->launches()->upcoming()->search();

Spacecraft

Spacecraft have an additional Flights endpoint you can access using the SDK. search() and fetch() are available on both.

$results = $client->spacecraft()->flights()->search();

Acknowledgements

Inspiration for the design of this SDK was taken from laravel/forge-sdk and KnpLabs/php-github-api.

License

Launch Library 2 SDK for PHP is open source software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固