Download the PHP package danae/soundcloud-php without Composer
On this page you can find all versions of the php package danae/soundcloud-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danae/soundcloud-php
More information about danae/soundcloud-php
Files in danae/soundcloud-php
Package soundcloud-php
Short Description Easy to use SoundCloud API wrapper for PHP
License GPL-3.0-or-later
Informations about the package soundcloud-php
soundcloud-php
soundcloud-php is a SoundCloud® API wrapper for PHP 7.4 or higher.
Installation
The SoundCloud library is best installed using Composer:
Alternatively include the following line in the require block in composer.json:
Usage
The following is a usage example of the library:
To use the library, you must create an instance of the Danae\SoundCloud\Soundcoud
class and provide your client_id and client_secret to the constructor:
Authorization
To use the client you must authenticate it first. The client has support for the auth_code
, client_credentials
and refresh_token
grants provided by the SoundCloud API. You can use one of the following methods to authenticate the client:
Upon succesful authorization, the access token will be automatically added to requests to the client, but can also be obtained via the client instance.
Authorize using an authorization code
Provide at least the client_id
, client_secret
and redirect_uri
keys to the constructor of the client. Then call the authorizeWithCode
method.
Authorize using client credentials
Provide at least the client_id
and client_secret
keys to the constructor of the client. Then call the authorizeWithClientCredentials
method.
Authorize using a refresh token
Making requests
When the client is authorized, you can use the following methods to make requests to the SoundCloud API and receive a stdClass
object created by json_decode
ing the response body. All request functions throw a Runtimexception
with the status code if the request failed.
For more information on the API itself, please refer to the SoundCloud API explorer or the accompanying guide.