imageseo/imageseo-php

ImageSeo API 的 PHP 库

v1.0.7 2020-02-08 15:31 UTC

This package is auto-updated.

Last update: 2024-09-09 01:28:49 UTC


README

ImageSEO SDK PHP

ImageSEO API 的官方 PHP SDK。这允许您使用我们的 API:[https://imageseo.io](https://imageseo.io)

API 文档:[https://docs.imageseo.io/](https://docs.imageseo.io/)

要求

  • PHP 版本 5.6 及以上
  • ImageSEO API 密钥,起始为免费级别 免费注册

安装

您可以通过 Composer 安装库。运行以下命令

composer require imageseo/imageseo-php

要使用库,请使用 Composer 的 自动加载

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

资源

查看所有资源:[https://docs.imageseo.io/resources](https://docs.imageseo.io/resources)

  • 项目 :

    • getOwner()
  • ImageReports

    • generateReportFromUrl($data,$query = null)
    • generateReportFromFile($data,$query = null)
  • 语言

    • getLanguages()

示例

认证

<?php

use ImageSeo\Client\Client;

$apiKey = "YOUR_API_KEY";
$client =new Client($apiKey);

资源

我们的 SDK 依据资源原理操作。您必须选择要在其上进行 API 调用的资源,以使用不同的方法。查看我们的资源列表

图像报告

示例:从 URL 生成图像报告

<?php

use ImageSeo\Client\Client;

$apiKey = "YOUR_API_KEY";
$client =new Client($apiKey);

$data = [
    "src": "https://example.com/image.jpg"
];
$report = $client->getResource('ImageReports')->generateReportFromUrl($data);

示例:从文件生成图像报告

<?php

use ImageSeo\Client\Client;

$apiKey = "YOUR_API_KEY";
$client =new Client($apiKey);

$data = [
    "filePath": "/path/your/image.jpg"
];
$report = $client->getResource('ImageReports')->generateReportFromFile($data);

语言

获取可用语言

<?php

use ImageSeo\Client\Client;

$apiKey = "YOUR_API_KEY";
$client =new Client($apiKey);

$report = $client->getResource('Languages')->getLanguages();

关于

imageseo-php 由 ImageSEO 开发团队指导和支持。

许可

MIT 许可证 (MIT)