kz/lifx-php

lifx-php is a PHP package for the LIFX HTTP API.

v1.0.1 2018-06-13 11:47 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:23:11 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

lifx-php is a PHP package for the LIFX HTTP API.

The author is not affiliated with LIFX and LIFX is not involved in the development of this package in any way.

Request for stakeholder comments! I am looking to gauge whether this package is still being used to decide whether to continue maintaining it. Please email me or open an issue to let me know whether you are looking to use any endpoints which are missing or whether you would like to see this package kept up to date.

Install

Via Composer

$ composer require kz/lifx-php

Laravel Configuration

lifx-php has optional support for Laravel and comes with a Service Provider and Facades for easy integration. The vendor/autoload.php is included by Laravel, so you don't have to require or autoload manually. Just see the instructions below.

After you have installed lifx-php, open your Laravel config file config/app.php and add the following lines.

In the $providers array add the service providers for this package:

Kz\Lifx\LifxServiceProvider::class,

Add the facade of this package to the $aliases array:

'Lifx' => Kz\Lifx\LifxFacade::class,

Now the Lifx Class will be auto-loaded by Laravel.

You also need to supply your API Token in your .env environment file:

LIFX_TOKEN=0000000000000000000000000000000000000000000000000000000000000000

Usage

$api_token = 'token';
$lifx = new Kz\Lifx\Lifx($api_token);
$lifx->toggleLights();

Laravel Usage

// usage inside a laravel route
Route::get('/', function()
{
    $lifx = Lifx::all();

    return json_decode($lifx);
});

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.