somms/phpkew

RGBKew的pykew库的PHP端口,用于访问Kew的数据服务

v0.9 2023-11-02 11:02 UTC

This package is auto-updated.

Last update: 2024-10-03 10:24:25 UTC


README

用于轻松访问Kew的命名和分类服务的库。隐藏了使用HTTP API的复杂性。此库提供了与Python库pykew相同的功能,只是将其翻译为PHP。

功能

  • 执行与Python库pykew相同的任务。
  • 使用PHP访问和操作Kew的Python API中的数据。

安装

要使用此库,您需要在系统上安装PHP。然后您可以使用Composer安装库。

  1. 打开终端并导航到您的项目目录。

  2. 运行以下命令安装库

    composer require somms/phpkew
    ```
    
    
  3. 在您的PHP代码中包含库

    require_once 'vendor/autoload.php';
    ```

使用方法

以下是如何使用库与POWO API的示例

// Include the library
require_once 'vendor/autoload.php';

use Somms\PHPKew\POWO\Enums\Characteristic;
use Somms\PHPKew\POWO\Enums\Filters;
use Somms\PHPKew\POWO\Enums\Geography;
use Somms\PHPKew\POWO\Enums\Name;
use Somms\PHPKew\POWO\POWOApi;

// Create a new instance of the pykew-php library
$powoApi = new POWOApi();

// Do a basic search
$result = $powoApi->search('Poa annua');

// $result extends ArrayIterator class

// Do an advanced search, filtering by several fields.
$query = [Name::GENUS => 'Poa', Name::SPECIES => 'annua', Name::AUTHOR => 'L.'];
$result = $powoApi->search($query);

IPNI和KPL非常相似。每个API的枚举包括每个API的可用过滤器。

许可协议

本项目采用MIT许可协议

项目状态

本项目正在积极维护,并欢迎社区贡献。