承接 agencyrepublic/webpurify 相关项目开发

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

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

agencyrepublic/webpurify

Composer 安装命令:

composer require agencyrepublic/webpurify

包简介

A third-party PHP library for implementing web purify

README 文档

README

Build Status

A library for interfacing with WebPurify.

The library is covered by PHPUnit tests using stub mocks and is PSR-0, PSR-1, PSR-2 and PSR-3 compliant.

Installation

Add the following to your composer.json.

{
	"require": {
		"agencyrepublic/webpurify": "dev-master"
	}
}

Usage

There are two classes which you can use to make requests to Web Purify:

  • WebPurify\WebPurifyImage
  • WebPurify\WebPurifyText

Most methods listed on the WebPurify documentation can be used as method names for making API calls. There is exception as return is a reserved keyword in PHP the method name is returnExpletives.

WebPurify

These methods are available in both classes.

setLogger

WebPurify class is a PSR-3 compliant LoggerAwareInterface. It outputs all HTTP requests and responses to a logger. You will need a logger (like Monolog).

$logger = new Logger('name');
$logger->pushHandler(new StreamHandler('path/to/your.log'));

$webPurifyImage = new WebPurify\WebPurifyImage($apiKey);
$webPurifyImage->setLogger($logger);

getUseSSL

Get whether SSL will be used for requests.

var_dump($webPurifyImage->getUseSSL()); // bool(FALSE)

setUseSSL

Set whether SSL will be used for requests. The default is false.

$webPurifyImage->setUseSSL(true); // Use SSL in requests

WebPurifyImage

Instantiate WebPurifyImage by passing through your API key:

$webPurifyImage = new WebPurify\WebPurifyImage($apiKey);

imgCheck

Returns: <imgid>

Documentation: webpurify.live.imgcheck

# string => imgurl
$webPurifyImage->imgCheck("http://.../");

# array => post data
$webPurifyImage->imgCheck(array(
	"imgurl" => "http://.../"
	// ...
));

imgStatus

Returns:

  • true => approved
  • false => declined
  • null => pending

Documentation: webpurify.live.imgstatus

# string => imgid
$webPurifyImage->imgStatus("0123456789abcdef0123456789abcdef");

# array => post data
$webPurifyImage->imgCheck(array(
	"imgid" => "0123456789abcdef0123456789abcdef"
	// ...
));

imgAccount

Returns: <remaining>

Documentation: webpurify.live.imgaccount

# No parameters
$webPurifyImage->imgAccount();

# array => post data
$webPurifyImage->imgAccount(array(
	// ...
));

WebPurifyText

Instantiate WebPurifyTexxt by passing through your API key:

$webPurifyText = new WebPurify\WebPurifyText($apiKey);

check

Returns: boolean <found>

Documentation: webpurify.live.check

# string => text
$webPurifyText->check("the quick brown fox jumps over the lazy dog");

# array => post data
$webPurifyText->check(array(
	"text" => "the quick brown fox jumps over the lazy dog"
	// ...
));

checkCount

Returns: boolean <found>

Documentation: webpurify.live.checkcount

# string => text
$webPurifyText->checkCount("the quick brown fox jumps over the lazy dog");

# array => post data
$webPurifyText->check(array(
	"text" => "the quick brown fox jumps over the lazy dog"
	// ...
));

replace

Returns: string <text>

Documentation: webpurify.live.replace

# string => text
$webPurifyText->checkCount("the quick brown fox jumps over the lazy dog");

# array => post data
$webPurifyText->check(array(
	"text" => "the quick brown fox jumps over the lazy dog"
	// ...
));

returnExpletives

Returns: array <word>

Documentation: webpurify.live.return

# string => text
$webPurifyText->returnExpletives("the quick brown fox jumps over the lazy dog");

# array => post data
$webPurifyText->returnExpletives(array(
	"text" => "the quick brown fox jumps over the lazy dog"
	// ...
));

addToBlackList

Returns: boolean <success>

Documentation: webpurify.live.addtoblacklist

# string => text
$webPurifyText->addToBlackList("scunthorpe");

# array => post data
$webPurifyText->addToBlackList(array(
	"word" => "scunthorpe"
	// ...
));

addToWhiteList

Returns: boolean <success>

Documentation: webpurify.live.addtowhitelist

# string => word
$webPurifyText->addToWhiteList("scunthorpe");

# array => post data
$webPurifyText->addToWhiteList(array(
	"word" => "scunthorpe"
	// ...
));

removeFromBlackList

Returns: boolean <success>

Documentation: webpurify.live.removefromblacklist

# string => word
$webPurifyText->removeFromBlackList("scunthorpe");

# array => post data
$webPurifyText->removeFromBlackList(array(
	"word" => "scunthorpe"
	// ...
));

removeFromWhiteList

Returns: boolean <success>

Documentation: webpurify.live.removefromwhitelist

# string => word
$webPurifyText->removeFromWhiteList("scunthorpe");

# array => post data
$webPurifyText->removeFromWhiteList(array(
	"word" => "scunthorpe"
	// ...
));

getBlackList

Returns: array <word>

Documentation: webpurify.live.getblacklist

# No parameters
$webPurifyText->getBlackList();

# array => post data
$webPurifyText->getBlackList(array(
	// ...
));

getWhiteList

Returns: array <word>

Documentation: webpurify.live.getwhitelist

# No parameters
$webPurifyText->getWhiteList();

# array => post data
$webPurifyText->getWhiteList(array(
	// ...
));

agencyrepublic/webpurify 适用场景与选型建议

agencyrepublic/webpurify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.87k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2013 年 12 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 agencyrepublic/webpurify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 agencyrepublic/webpurify 我们能提供哪些服务?
定制开发 / 二次开发

基于 agencyrepublic/webpurify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-05