jolitagrazyte/discogs-api
Composer 安装命令:
composer require jolitagrazyte/discogs-api
包简介
A simple Discogs Api wrapper using Guzzle7.
关键字:
README 文档
README
This package makes it easy to communicate with discogs-api. It uses Guzzle 7 and is very simple to install and to use.
You can use it with any PHP framework or just simply in your naked PHP application.
However, if you want to use it in Laravel framework, I'd suggest to also install jolitagrazyte/laravel-discogs package, which provides a facade for even an easier way to play with it.
Installation
You can install the package via composer:
composer require jolitagrazyte/discogs-api
Usage
Endpoints with no authentication required
For the endpoints, where token is not required, first argument can be easily left empty.
$discogs = new DiscogsApi(); //get artist with id 1 $artist = $discogs->artist('1'); //get releases of the artist with id 1 $artistReleases = $discogs->artistReleases('1'); //get label with id 1 $label = $discogs->label('1'); //get releases of the label with id 1 $labelReleases = $discogs->labelReleases('1'); //get release with id 1 $releases = $discogs->releases('1'); //get master release with id 1 $masterRelease = $discogs->masterRelease('1');
Endpoints where authentication is required
For the endpoints, where token is required, you must add your discogs-token.
You can obtain it at https://www.discogs.com/settings/developers.
Orders
To get your orders, you can use getMyOrders()-method.
Orders list comes paginated with a default - 50 orders per page, but it can be changed.
If you need, you can add some optional parameters: page, perPage (with a max of 100), order status as status, sort and sortOrder.
If you need more information about the parameters you can read about it at https://www.discogs.com/developers.
$discogs = new DiscogsApi('discogs-token', 'app-name'); //get orders $orders = $discogs->getMyOrders(); /** * get orders with parameters: * in this example page = 3, perPage = 25, status = shipped, sort = created, sortOrder = desc */ $ordersWithOptions = $discogs->getMyOrders(3, 25, "shipped", "created", "desc");
For getting one specific order by id:
$discogs = new DiscogsApi('discogs-token', 'app-name'); //get order with id $order = $discogs->orderWithId('123');
It is also possible to retrieve the messages of an order:
$discogs = new DiscogsApi('discogs-token', 'app-name'); //get messages of an order with id $ordersMessages = $discogs->orderMessages('123');
For changing the status of the order or adding the shipping to the order.
$discogs = new DiscogsApi('discogs-token', 'app-name'); //change order status to 'Shipped' $orders = $discogs->changeOrderStatus('123', 'Shipped'); //add shipping to an order with id $order = $discogs->addShipping('123', '12.60');
Search
If you want to add some extra search parameters you can do it by first creating a SearchParameters object and then chaining as many options as you want.
$discogs = new DiscogsApi('discogs-token', 'app-name'); // create a SearchParameters object and chain some search paramater $searchParameters = SearchParameters::make()->format('LP')->year('1996'); //do a search request with a query = 'MoWax' and passing the SearchParameters object $searchResult = $discogs->search('MoWax', $searchParameters);
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email hello@jolitagrazyte.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
jolitagrazyte/discogs-api 适用场景与选型建议
jolitagrazyte/discogs-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 662 次下载、GitHub Stars 达 11, 最近一次更新时间为 2016 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Discogs Api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jolitagrazyte/discogs-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jolitagrazyte/discogs-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jolitagrazyte/discogs-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP library for accessing the Discogs API
A PSR-7 compatible library for making CRUD API endpoints
Discogs OAuth1 Provider for Laravel Socialite
The forked and updated as of end of 2024, Discogs API, that makes it easy for developers to communicate with the Discogs platform
A package to maintain a searchable database of vinyl records
Laravel Library to use Discogs API
统计信息
- 总下载量: 662
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-28