atomescrochus/laravel-deezer-api

此包已被弃用且不再维护。没有建议的替代包。

从任何 Laravel >= 5.3 应用程序中与 Deezer API 交互的简单方法。

1.5.1 2017-10-09 19:57 UTC

This package is auto-updated.

Last update: 2020-04-07 18:54:46 UTC


README

Latest Stable Version License Total Downloads

atomescrochus/laravel-deezer-api 包为从任何 Laravel >= 5.3 应用程序中搜索 Deezer Web API 提供了一种简单的方法。

此包可用于生产环境,但仍被视为一个正在进行中的项目(欢迎贡献!)。它需要 PHP >= 7.0

安装

您可以通过 composer 安装此包

$ composer require atomescrochus/laravel-deezer-api

然后您需要安装包的服务提供者,除非您正在运行 Laravel >=5.5(它将使用包自动发现)

// config/app.php
'providers' => [
    ...
    Atomescrochus\Deezer\DeezerApiServiceProvider::class,
];

用法

// here is an example query to search Deezer's API
$deezer = new \Atomescrochus\Deezer\Deezer();

// You can execute a basic search, and hope for the best
$results = $deezer->basicSearch("yolo");

// If you already have a Deezer ID, you can do thise to get the track
$results = $deezer->getTrackById(18042083); //

// But you can also execute more complex search
$results = $deezer->artist() // string
        ->album() // string
        ->track() // string
        ->label() // string
        ->minimumDuration() // int
        ->maximumDuration() // int
        ->minimumBPM() // int
        ->maximumBPM() // int
        ->search();

// These are the options you can set with every kind of call
$deezer->cache(120) // an integer (number of minutes), for the cache to expire, can be 0

// Theses are options compatible with basicSearch() and complexe searches
$deezer->strictMode() // deactivate fuzzy searching on Deezer's side
$deezer->type('track') // defaults to track if not set. 
// see http://developers.deezer.com/api/search#connections for possible search types
$deezer->order('ranking') // defaults to ranking if not set. Use lower case!
// see http://developers.deezer.com/api/search#infos for possible order

结果

在上面的示例中,$results 返回的对象包含:结果集合;结果的数量值;原始响应数据;以及发送到 API 的未格式化查询。

测试

这基本上是 API 的包装器。我们假设 Deezer API 已经经过测试,并且不会重复测试。

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

贡献

有关详细信息,请参阅 CONTRIBUTINGCONDUCT

安全

如果您发现任何安全问题,请通过电子邮件发送到 jp@atomescroch.us 而不是使用问题跟踪器。

鸣谢

许可

MIT 许可证(MIT)。有关更多信息,请参阅 许可文件