merlinoff/similar-web-api
Composer 安装命令:
composer require merlinoff/similar-web-api
包简介
API for SimilarWeb is a project created by SimilarGroup company. It collects and provides access to various website analytics. This is a PHP library implementing easy access to their API.
README 文档
README
Introduction
SimilarWeb is a project created by SimilarGroup company. It collects and provides access to various website analytics. This is a PHP library implementing easy access to their API.
Requirements:
- PHP 5.3 (namespaces),
- php-curl-class library (Curl request lib).
Installation:
This library is available on Packagist and uses merlinoff/SimilarWebApi alias. If you use Composer (and if you don't I don't know what you're waiting for) you can composer require it:
composer require merlinoff/similar-web-api
Alternatively you can place it manually inside your composer.json:
(...)
"require": {
"merlinoff/similar-web-api": "dev-master"
}
(...)
and then run composer install or composer update as required.
You can of course make it a git submodule, download and place it in your project next to your regular code or something, but really, do yourself (and the whole industry) a favor and use Composer.
Usage:
All APIs implemented in this library have the Request and Response classes named corresponding to those defined in SimilarWeb API documentation. Expected data should be retrieved by first visiting SimilarWeb API documentation and then using Request class with the same name located in src/Request directory. Method getResponse() demonstrated below will automatically match, create and return matching Response class object which can be type hinted and relied on. There is also ClientFacade class which contains easy to use interface (note that this class is auto-generated):
use merlinoff\SimilarWeb; // create client object $sw = new SimilarWeb($token); $sw->setDomain("google.com"); // fetch response by passing API call name and desired domain $result = $sw->getRankAndReach(); // or get category rank $result = $sw->getCategoryRank(); // or get Traffic $result = $sw->getTraffic("9-2014", "2-2015"); etc...
APIs return objects with keys containing four types of data:
During either composer install, composer update or manual execution of php bin/generate command, API mapping configuration is used to generate domain request and response classes with methods hiding library complexity behind readable accessors. Such approach makes it possible to have readable class API, good IDE autocompletion and highlighting possibilities with no additional programming work. When response is parsed all elements of given type are put inside their containers and those response classes act as a facade for raw response object.
License
GNU General Public License
merlinoff/similar-web-api 适用场景与选型建议
merlinoff/similar-web-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 merlinoff/similar-web-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 merlinoff/similar-web-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GNU
- 更新时间: 2015-03-26