承接 mtxserv/wazuh-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mtxserv/wazuh-api

最新稳定版本:v1.0.1

Composer 安装命令:

composer require mtxserv/wazuh-api

包简介

PHP library for interacting with the Wazuh Rest API.

README 文档

README

Latest Stable Version

The Wazuh API PHP Client is a modern library built on top of Guzzle, providing an efficient interface for interacting with the Wazuh REST API.

Requirements

  • PHP 7 or 8

Installation

The recommended way to install the Wazuh API PHP Client is via Composer, a powerful package manager for PHP:

composer require mtxserv/wazuh-api

Usage

Below is a basic example illustrating how to instantiate the client and retrieve a list of agents:

<?php

use Wazuh\WazuhClient;
use GuzzleHttp\Exception\GuzzleException;
use JsonException;

require_once 'vendor/autoload.php';

// Setup WazuhClient with necessary parameters
$client = new WazuhClient([
    'base_uri' => 'https://wazuh.my.instance:55000',
    'wazuh_user' => 'my_user',
    'wazuh_password' => 'my_password',
    'verify' => true, // SSL Certificate verification
]);

try {
    // Retrieve list of agents
    $response = $client->get('/agents');

    // Decode JSON response and handle JSON exceptions
    try {
        $json = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
    } catch (JsonException $jsonException) {
        echo 'JSON decoding error: ', $jsonException->getMessage(), "\n";
        return;
    }

    var_dump($json);
} catch (GuzzleException $e) {
    echo 'HTTP request error: ', $e->getMessage(), "\n";
}

In this example, we're connecting to a Wazuh instance, authenticating with a username and password, and requesting a list of agents. We're also handling any potential exceptions that might be thrown during this process.

Support

For more examples and usage instructions, please refer to the official Wazuh API documentation.

If you encounter any issues, feel free to open an issue on this GitHub repository.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-19