PHP Web Service

Post Reply
Posts: 2
Joined: Wed May 15, 2019 9:00 am

Wed May 15, 2019 9:16 am

Hi everyone - my first post here!

I am trying to build a back-end webservice in PHP to control Supla devices.

I have a hosted linux server at my ISP and I have an Alexa Custom Skill hosted at Amazon.

The amazon skill is for an existing client of mine and already works very well. What it does is take amazon "intents" and convert them to various forms of communication with other devcies. For example it might post JSON to another webservice, or send MQTT messages to a broker. My hosted server also logs device inventories, service requests and so on in a MySQL database. This is all working well.

So what I can't get my head round is the control flow for Supla.
Here's what I have done:
I have looked at the PHP Supla Client at :
I have created an OAuth Application under "My OAuth Apps" on Supla.
I have authorised that app in my account at Supla.
I have used "composer" to install the required components on my server.
(We can assume for the purposes of getting this working that my account is the only account) Account linking will come one I get my head round the control flow. I already do amazon account linking, so I should be able to cope with that.

Here's where I am stuck.
The instructions at are missing. They stop at a very brief example: $client->getServerInfo();
What I'd like is an example of how my PHP Webservice should now work.
I've done this bit:

Code: Select all

$client = new \Supla\ApiClient\SuplaApiClient([
    'server' => '',
    'clientId' => 'YOUR_CLIENT_ID',
    'secret' => 'YOUR_SECRET',
    'username' => 'YOUR_USERNAME',
    'password' => 'YOUR_PASSWORD',
Where do I go from here to request an appropriate scope, and send control commands to a Supla device?
Does anyone have any example code for a back-end web service in PHP?
Posts: 333
Joined: Wed May 17, 2017 1:27 pm

Wed May 15, 2019 9:57 am

Check this site: ... ceChannels

On swagger hub you got API schema for Supla Cloud. Just click Export > Client SDK > PHP and you will have fully working PHP client for Supla
Posts: 2
Joined: Wed May 15, 2019 9:00 am

Wed May 15, 2019 10:05 am

Thanks for that - I will check it out.
Post Reply