northern-lights/polr-client
Composer 安装命令:
composer require northern-lights/polr-client
包简介
Client for Polr API
README 文档
README
Introduction
REST API client written in PHP for cydrobolt/polr
Provides simple interface for interaction with Polr instances
Usage
Very minimal example, using default configuration
<?php namespace NorthernLights\Client\Polr\Example; use NorthernLights\Client\Polr\ApiClient; use NorthernLights\Client\Polr\Config\Config; use NorthernLights\Client\Polr\Response\ShortenResponseInterface; /** * Initialize API client and pass $config to it (DI) * @var ApiClient $api */ $api = new ApiClient(); /** * Shorten the long URL. * @var ShortenResponseInterface $response */ $response = $api->shorten('https://www.polrproject.org'); // Check if API request was successful. Remains true as long as HTTP status code equals 200 OK if (!$response->wasSuccessful()) { echo 'There was an error querying the api' . PHP_EOL; exit(1); } echo 'Short URL is ' . $response->getShortUrl() . PHP_EOL;
For more detailed examples and configuration, please take a look in examples. All use scenarios are covered.
- configuration
- lookup [/api/v2/action/lookup]
- shorten [/api/v2/action/shorten]
- shorten_bulk [/api/v2/action/shorten_bulk]
- data [/api/v2/data/link]
Installation
The recommended way to install is via Composer:
composer require northern-lights/polr-client
Alternatively, you can download latest stable version from releases.
Please note that this library doesn't ship with autoloader, but relies on Composer internal autoloader.
Industry standards and best practices
Library strives to comply with latest standards and best practices in the industry therefore we included
PSR-2 coding standard Compliance check & fix
We want the code to be as good as it is possible
$ composer check-style $ composer fix-style
Note: Second command will actually modify files
Code syntax check (lint)
Very basic check which saves us the trouble
$ composer php-lint
Static Code Analysis
So we catch bugs early.
$ composer phpsam
Unit testing
So we make sure that all moving parts are running smoothly
$ composer test
TODO
- Implement shorten_bulk [/api/v2/action/shorten_bulk]
- Add Unit tests
- Add detailed API documentation
Disclaimer
This project or it's authors are not affiliated with the Polr Project or any third party.
License
The MIT License (MIT). Please see License File for more information.
northern-lights/polr-client 适用场景与选型建议
northern-lights/polr-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 231 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 12 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 northern-lights/polr-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 northern-lights/polr-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 231
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-12