Getting started

This page assumes that you have cloned the WordPress plugin SVN structure (assets, tags, trunk) and are ready to begin installing the SDK in the trunk directory.

Installation is done in the following steps:

  1. Download the SDK into a source directory
  2. Rename the SDK namespace
  3. Add the SDK namespace into your Composer

1. Download the SDK into a source directory

Good coding practise says we should keep our code in a separate directory. Let’s say src/

git clone

In src/sdk you should now have the files base.php, composer.json, and the directory wordpress, amongst others. Download is complete.

2. Rename the SDK namespace (optional, but a good idea)

The SDK has the namespace plainview\sdk. This is fine, but if you plan to release your plugin it could be installed together with another plugin that uses the Plainview SDK. Class autoloading will load one of the SDK’s, and there is no knowing whether it will be your or the other plugin’s version. This is a conflict that must be avoided by renaming your SDK namespace.

In the scripts/ directory you will find a script called This file runs a search and replace using Perl to rename the namespace to something more unique.


This will rename all of the namespaces in the SDK to plainview\sdkSUFFIX. Your plugin should now use this namespace instead of the default.

3. Add the SDK namespace into your Composer (also optional)

Using Composer for its class autoloading is a good idea. Add the SDK’s customized namespace into your composer.json. Here is the autoload portion of ThreeWP Broadcast’s composer.json.

		"threewp_broadcast\\": "src/",
		"plainview\\sdk_broadcast\\": "src/sdk/"

Run composer dump and the SDK should now be autoloaded in your plugin!

Updating the SDK

If you wish to update the SDK, either due to new features or perhaps a bug being fixed, go to the scripts directory and run


This will restore the SDK to its original state, download the newest version via Git, and then rename the namespace again.


Leave a Reply

Your email address will not be published. Required fields are marked *