uvasoftware/scanii-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

uvasoftware/scanii-php

Composer 安装命令:

composer require uvasoftware/scanii-php

包简介

Zero-dependency PHP SDK for the Scanii content security API

README 文档

README

Official PHP SDK for the Scanii content processing API.

SDK Principles

  1. Light. Zero runtime dependencies, stdlib only.
  2. Up to date. Always current with the latest Scanii API.
  3. Integration-only. Wraps the REST API — retries, concurrency, and batching are the caller's responsibility.

The only stdlib extensions required are ext-curl and ext-json, both shipped by default with every official PHP distribution (including the Windows builds).

Install

composer require scanii/scanii-php

Requires PHP 8.4 or newer.

Quickstart

use Scanii\ScaniiClient;
use Scanii\ScaniiTarget;

$client = ScaniiClient::create('your-api-key', 'your-api-secret', ScaniiTarget::US1);

// Scan a file from disk:
$result = $client->process('/path/to/file');
echo implode(', ', $result->findings);

ScaniiClient::create returns a thread-friendly client that you can reuse across requests; the constructor performs no I/O.

Scanning from a stream

Pass any PHP stream resource — fopen(), tmpfile(), php://temp, etc.:

// From a temp file / in-memory stream:
$stream = fopen('php://temp', 'r+');
fwrite($stream, $content);
rewind($stream);

$result = $client->processStream($stream, 'upload.bin');
echo implode(', ', $result->findings);
fclose($stream);

API

Method REST Returns
process($path, $metadata, $callback) POST /files ScaniiProcessingResult
processStream($stream, $filename, $contentType, $metadata, $callback) POST /files ScaniiProcessingResult
processAsync($path, $metadata, $callback) POST /files/async ScaniiPendingResult
processAsyncStream($stream, $filename, $contentType, $metadata, $callback) POST /files/async ScaniiPendingResult
processFromUrl($location, $callback, $metadata) POST /files ScaniiProcessingResult (v2.2 preview)
fetch($location, $metadata, $callback) POST /files/fetch ScaniiPendingResult
retrieve($id) GET /files/{id} ScaniiProcessingResult
retrieveTrace($id) GET /files/{id}/trace ?ScaniiTraceResult (v2.2 preview)
ping() GET /ping bool
createAuthToken($timeoutSeconds) POST /auth/tokens ScaniiAuthToken
retrieveAuthToken($id) GET /auth/tokens/{id} ScaniiAuthToken
deleteAuthToken($id) DELETE /auth/tokens/{id} void
retrieveAccountInfo() GET /account.json ScaniiAccountInfo

Full API reference: https://scanii.github.io/openapi/v22/.

Regional endpoints

Constant Endpoint
ScaniiTarget::US1 https://api-us1.scanii.com
ScaniiTarget::EU1 https://api-eu1.scanii.com
ScaniiTarget::EU2 https://api-eu2.scanii.com
ScaniiTarget::AP1 https://api-ap1.scanii.com
ScaniiTarget::AP2 https://api-ap2.scanii.com
ScaniiTarget::CA1 https://api-ca1.scanii.com
ScaniiTarget::AUTO https://api.scanii.comdeprecated, does not guarantee regional data placement

Pass any string URL for a custom or local endpoint:

$client = ScaniiClient::create('key', 'secret', 'http://localhost:4000');

Local development with scanii-cli

Run the integration tests against a local mock server — no real credentials needed:

docker run -d --name scanii-cli -p 4000:4000 ghcr.io/scanii/scanii-cli:latest server
composer install
composer test

Test credentials: key key, secret secret, endpoint http://localhost:4000.

Migration from uvasoftware/scanii-php

-"uvasoftware/scanii-php": "^5.0"
+"scanii/scanii-php": "^6.0"

The PHP namespace is unchanged (Scanii\…). Other notable changes:

  • The runtime no longer depends on Guzzle. Only ext-curl and ext-json (both stdlib).

  • The autoloader uses PSR-4 — src/Scanii/... files moved up to src/....

  • Result objects use public readonly properties instead of getters:

    - $r->getFindings()
    + $r->findings
  • process / processAsync / fetch now take an explicit nullable ?string $callback last arg (previously implicit through metadata):

    - $client->fetch($url, $callback, $metadata)
    + $client->fetch($url, $metadata, $callback)
  • Errors throw Scanii\ScaniiException (and ScaniiAuthException, ScaniiRateLimitException subclasses), not Guzzle exceptions.

The old composer coordinate uvasoftware/scanii-php is deprecated and will not receive further updates.

API documentation

See https://scanii.github.io/openapi/v22/ for the full Scanii API contract.

License

Apache 2.0 — see LICENSE.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-03-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固