dev-master
9999999-devPHP library for the Spark.io API
MIT
The Requires
The Development Requires
by Gareth Davies
spark
PHP library for the Spark.io API
PHP library for the Spark.io API., (*2)
Makes it incredibly easy to get up and running using the default Tinker firmware or any custom function/variable that is exposed by your core firmware. You can also use the library to access/generate tokens and flash firmware to your core., (*3)
More detailed examples will follow shortly but basic operations may be found in the examples directory., (*4)
$core = SparkCore::make($accessToken); $core->setPin('D7'); $core->setValue('HIGH'); $core->digitalWrite(); //Will turn on the inbuilt LED
The recommended way to install the library is through Composer., (*5)
# Install Composer curl -sS https://getcomposer.org/installer | php # Add Spark as a dependency php composer.phar require wensleydale/spark:dev-master
After installing, you need to require Composer's autoloader:, (*6)
require 'vendor/autoload.php';
You may list all your tokens, generate a token or delete a token, (*7)
$tokenInstance = SparkCore::token(); $tokenInstance->setUsername('your_spark_username'); $tokenInstance->setPassword('your_spark_password'); $listTokens = $tokenInstance->listTokens();
If there are any issues during the API request a SparkException or SparkTokenException will be thrown which can be caught and managed according to your application needs., (*8)
This library uses PHPUnit for unit testing. In order to run the unit tests, you'll first need
to install the dependencies of the project using Composer: php composer.phar install --dev
.
You can then run the tests using vendor/bin/phpunit
. The library comes with a set of mocked responses
from the Spark API, (*9)
PHP library for the Spark.io API
MIT
spark