squiz/elasticio-php-client

Elastic.io v2 的客户端库

dev-master 2019-05-27 00:31 UTC

This package is not auto-updated.

Last update: 2024-09-24 04:07:04 UTC


README

符合 PSR-4 的 ElasticIO 管理API版本 2 的PHP客户端

如何安装

  • 需要最低PHP版本 > 7.1
  • composer install

示例用法

// Username and API Key needs to be defined.
define('USERNAME', '');
define('APIKEY', '');

// Retrieving an exsting flow.
$flowid = 'FLOWID_TO_RETRIEVE';
$json   = Factory::get('flow')->retrieveByID($flowid)->getResponse();

// Creating a new workspace.
$json = Factory::get('workspace')->create(
    [
        'type'          => 'workspace',
        'attributes'    => ['name' => 'New Workspace Name'],
        'relationships' => [
            'contract' => [
                'data' => [
                    'id'   => $contractid,
                    'type' => 'contract',
                ]
            ]
        ]
    ]
)->getResponse();