lifx-php is a PHP package for the LIFX HTTP API
Switch branches/tags
Nothing to show
Clone or download

README.md

lifx-php

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.

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.