Hysen Labs
Open-source project
njasm/soundcloud avatar
njasm

soundcloud

Soundcloud.com API wrapper written in PHP with OAuth2 support.

100 stars23 forksPHPLicense varies
01
DEEP OPEN-SOURCE ANALYSIS

soundcloud: a PHP wrapper for the Soundcloud API

A PHP wrapper around the Soundcloud API with OAuth2 support, covering user auth, the full set of REST methods, and media download and upload, installed through composer.

02
DEEP OPEN-SOURCE ANALYSIS

What the wrapper covers

The wrapper gives PHP projects a way to talk to the Soundcloud API with OAuth2. The README lists user authorization and authentication, the user credentials flow, access to every GET, PUT, POST, and DELETE resource, and media file download and upload. Authenticated requests and file operations are both inside the scope, which is a fairly complete slice of what the API offers.

03
DEEP OPEN-SOURCE ANALYSIS

Installation paths

Composer is the recommended route. Add the package to composer.json and pull it in. For projects that skip composer, an autoload.php file lets you start the same way, and the script that uses the facade or client class should include the Njasm Soundcloud namespace.

04
DEEP OPEN-SOURCE ANALYSIS

The facade and token flow

SoundcloudFacade carries the boilerplate: getting an authorization URL and trading a code for a token. The user credentials flow works with it, and when Soundcloud returns an access token, the wrapper sets it automatically for later requests. The Response object comes back to the caller every time.

05
DEEP OPEN-SOURCE ANALYSIS

A few API notes

Soundcloud stopped replying in XML, so the README notes that the XML methods survive in the 2.x versions but do nothing when called. All requests send an accept header of application json instead. The note saves developers from chasing a feature that no longer has a backend behind it.

06
DEEP OPEN-SOURCE ANALYSIS

How requests actually fire

Parameters for a resource can be handed over as an array or through a setParams method, and the actual request only leaves when you invoke request(). Some operations, like userCredentials() and download(), trigger request() on their own, so the timing depends on which call you make.

07
DEEP OPEN-SOURCE ANALYSIS

Editorial conclusion

The README describes a PHP Soundcloud wrapper with OAuth2, the user credentials flow, and full REST and media support. Composer is the recommended install, with an autoload path for the rest.

08
DEEP OPEN-SOURCE ANALYSIS

Official sources

09
Community notes

Community notes