定制 romeritocl/cachet-api-client 二次开发

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

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

romeritocl/cachet-api-client

Composer 安装命令:

composer require romeritocl/cachet-api-client

包简介

Cachet Api client

README 文档

README

CircleCI: CircleCI

Latest Stable Version composer.lock Scrutinizer Code Quality

✋ What is it?

Simple API client for CachetHQ. A PHP Based Api client that will help you organize calls and support objects and models for all Cachet API endpoints. Cachet is an open source status page system written in PHP. https://github.com/CachetHQ/Cachet.

💾 Installation

Install the library by:

  • Downloading it from here

https://github.com/romeritoCL/cachet-api-client/releases/latest

  • Using Composer:
composer require romeritocl/cachet-api-client

Finally, be sure to include the autoloader:

require_once '/path/to/your-project/vendor/autoload.php';

Once the library is ready and inside the project the stub objects will available and the Client class will also available.

Usage

Setup

use DevoraliveCachet\Client;

$endpoint = 'https://demo.cachethq.io/api/v1/';
$token    = '9yMHsdioQosnyVK4iCVR';

$client = new Client($endpoint, $token);

StandAlone Errors

Doctrine annotation error:

PHP Fatal error:  Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@JMS\Serializer\Annotation\Type" in property (...) does not exist, or could not be auto-loaded.'

Can fix it registering the JMS namespace, locate your bootstrap.php file and add this line at the end:

Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');

Components

Get components

$components = $client->getComponents();

foreach ($components as $component) {
    echo $component->getName();
}

Sorting

$components = $client->getComponents([
    'sort' => 'id',
    'order' => 'desc'
]);

Get by id

$component = $client->getComponent(3);

Create new component

$component = new Component();
$component->setName('My new component');
$component->setDescription('Component description');
$component->setLink('https://github.com/mangati/cachet');
$component->setStatus(Component::STATUS_OPERATIONAL);

$client->addComponent($component);

Update an existing component

$component = new Component();
$component->setId(3);
$component->setName('My new component (updated)');

$client->updateComponent($component);

Delete an existing component

$id = 3;

$client->deleteComponent($id);

Incidents

Get incidents

$incidents = $client->getIncidents();

foreach ($incidents as $incident) {
    echo $incident->getName();
}

Sorting

$incidents = $client->getIncidents([
    'sort' => 'id',
    'order' => 'desc'
]);

Get by id

$incident = $client->getIncident(3);

Create new incident

$incident = new Incident();
$incident->setName('My new incident');
$incident->setMessage('incident message');
$incident->setStatus(Incident::STATUS_WATCHING);

$client->addIncident($incident);

Update an existing incident

$incident = new Incident();
$incident->setId(3);
$incident->setStatus(Incident::STATUS_FIXED);

$client->updateIncident($incident);

Delete an existing incident

$id = 3;

$client->deleteIncident($id);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固