PHPackages                             wensleydale/spark - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. wensleydale/spark

ActiveLibrary[API Development](/categories/api)

wensleydale/spark
=================

PHP library for the Spark.io API

192766PHP

Since Mar 20Pushed 12y ago7 watchersCompare

[ Source](https://github.com/garethtdavies/SparkPHP)[ Packagist](https://packagist.org/packages/wensleydale/spark)[ RSS](/packages/wensleydale-spark/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

SparkPHP
========

[](#sparkphp)

[![Build Status](https://camo.githubusercontent.com/d87ce0cfb333ab2d2b54cadb718d7971b7e0b26ecdd0a5e77db6d927d6026a98/68747470733a2f2f7472617669732d63692e6f72672f676172657468746461766965732f537061726b5048502e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/garethtdavies/SparkPHP)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/067e7377b955be599340f7b795acb0f530a66ff1805a6dc1937fbe6b398eeb65/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676172657468746461766965732f537061726b5048502f6261646765732f7175616c6974792d73636f72652e706e673f733d66326637646136336266663033633332613836653361316636636463656137633663313462346532)](https://scrutinizer-ci.com/g/garethtdavies/SparkPHP/)[![Code Coverage](https://camo.githubusercontent.com/b94ae23135b5a5f96e1d1d36e2bb6a3467add730d7099fa4c2302ebd8dc5c5b2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676172657468746461766965732f537061726b5048502f6261646765732f636f7665726167652e706e673f733d30393438646161666236306134656630656565613332306439643135383036346334383737343863)](https://scrutinizer-ci.com/g/garethtdavies/SparkPHP/)

PHP library for the [Spark.io API](http://docs.spark.io/#/api).

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.

More detailed examples will follow shortly but basic operations may be found in the examples directory.

### Turning on a LED using default tinker firmware

[](#turning-on-a-led-using-default-tinker-firmware)

```
$core = SparkCore::make($accessToken);
$core->setPin('D7');
$core->setValue('HIGH');
$core->digitalWrite(); //Will turn on the inbuilt LED

```

### Installing via Composer

[](#installing-via-composer)

The recommended way to install the library is through [Composer](http://getcomposer.org).

```
# 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:

```
require 'vendor/autoload.php';
```

### Managing Tokens

[](#managing-tokens)

You may list all your tokens, generate a token or delete a token

```
$tokenInstance = SparkCore::token();
$tokenInstance->setUsername('your_spark_username');
$tokenInstance->setPassword('your_spark_password');
$listTokens = $tokenInstance->listTokens();

```

### Exceptions

[](#exceptions)

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.

### Unit Tests

[](#unit-tests)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/947d18667b95c03befacd5f20dae7127b954f2cefcbc17e30b8bf031c23ba194?d=identicon)[garethtdavies](/maintainers/garethtdavies)

### Embed Badge

![Health badge](/badges/wensleydale-spark/health.svg)

```
[![Health](https://phpackages.com/badges/wensleydale-spark/health.svg)](https://phpackages.com/packages/wensleydale-spark)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
