dev-master
9999999-dev https://github.com/DomLip94/SoundCloudFetcherSimple PHP Wrapper for Soundcloud API
MIT
The Requires
- php >=5.3.0
api php soundcloud music
Simple PHP Wrapper for Soundcloud API
The quickest way to get going is by using Composer (it's 2019)., (*1)
Do so by executing the command below in your cli:, (*2)
composer require domlip94/soundcloudfetcher
To use, firstly we instantiate the class, (*3)
$soundCloud = new SoundCloud([ 'client_id' => null, 'client_secret' => null ]);
The client_secret is not usually required, but client_id is., (*4)
At the minute the only available methods are resolve and fetch track data, I intend to add more methods soon., (*5)
Alternatively, you can call an undefined API method yourself (see below.), (*6)
This resolves a SoundCloud URL to a track ID as an integer, which you may need for other API calls., (*7)
It is called like so:, (*8)
$soundCloud->resolveSoundCloudUrl(TRACK_URL);
The TRACK_URL argument would obviously be the link to the track, like below., (*9)
$soundCloud->resolveSoundCloudUrl('https://soundcloud.com/adamstuartfunston/af-podcast-014'); $soundCloud->resolveSoundCloudUrl($trackUrl);
This then returns, (*10)
(int) 649287689
This returns the track data as an array., (*11)
You can either choose certain array keys to return, or return everything., (*12)
It is called like so:, (*13)
$soundCloud->fetchTrackData(TRACK_URL, ARRAY_KEYS_TO_RETURN);
So an example would be,, (*14)
$soundCloud->fetchTrackData('https://soundcloud.com/adamstuartfunston/af-podcast-014');
$soundCloud->fetchTrackData('https://soundcloud.com/adamstuartfunston/af-podcast-014', [ 'duration' ]);
$soundCloud->fetchTrackData('https://soundcloud.com/adamstuartfunston/af-podcast-014', [ 'title', duration' ]);
While I build this out, only the basics are available. However, the two methods above call the same method to execute their call., (*15)
That method is:, (*16)
$soundCloud->doApiCall(API_METHOD, METHOD_ARGUMENTS);
Simple PHP Wrapper for Soundcloud API
MIT
api php soundcloud music