PHPackages                             williamson/tplinksmartplug - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. williamson/tplinksmartplug

ActiveLibrary[HTTP &amp; Networking](/categories/http)

williamson/tplinksmartplug
==========================

A PHP library to control and receive information from a TP-Link smartplug.

v0.0.3(9y ago)132.6k↓61.9%7[1 issues](https://github.com/jonnywilliamson/tplinksmartplug/issues)[1 PRs](https://github.com/jonnywilliamson/tplinksmartplug/pulls)MITPHP

Since Jan 5Pushed 3y ago3 watchersCompare

[ Source](https://github.com/jonnywilliamson/tplinksmartplug)[ Packagist](https://packagist.org/packages/williamson/tplinksmartplug)[ RSS](/packages/williamson-tplinksmartplug/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

PHP Library to Control and Access a TP-Link Smartplug!
======================================================

[](#php-library-to-control-and-access-a-tp-link-smartplug)

[![Smart Plug](https://raw.githubusercontent.com/jonnywilliamson/tplinksmartplug/master/tplinkplug.jpg)](https://github.com/jonnywilliamson/tplinksmartplug)
[![Build Status](https://camo.githubusercontent.com/953d762b65c5123dc521ca0aa20be621b4a52f878fbd6a609eb3364a2bc3cbfe/68747470733a2f2f7472617669732d63692e6f72672f6a6f6e6e7977696c6c69616d736f6e2f74706c696e6b736d617274706c75672e7376673f6272616e63683d6d6173746572)](https://github.com/jonnywilliamson/tplinksmartplug)[![Total Downloads](https://camo.githubusercontent.com/f1b29736339f1a45aeb1f4c2bc8a5cb541b21d97b3db205954a093bb2d8e5944/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c69616d736f6e2f74706c696e6b736d617274706c75672f646f776e6c6f616473)](https://github.com/jonnywilliamson/tplinksmartplug)[![Latest Stable Version](https://camo.githubusercontent.com/63eb1227fc725c6600eeb217e1a25642dca4f000dbf14cecefc792a5e4f29eae/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c69616d736f6e2f74706c696e6b736d617274706c75672f762f737461626c65)](https://github.com/jonnywilliamson/tplinksmartplug)[![License](https://camo.githubusercontent.com/257e0dbf14571d5794b50a9e4cada6ecec935bcb7e06ded7d18785d804b153e3/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c69616d736f6e2f74706c696e6b736d617274706c75672f6c6963656e7365)](https://github.com/jonnywilliamson/tplinksmartplug)

\###(Bonus Laravel integration supported!!)

**[TPLink Smartplug](https://github.com/jonnywilliamson/tplinksmartplug) is a small PHP library that allows anyone to control and access a TPLink Smartplug.**

Current TPLINK models supported are

- [HS110](http://uk.tp-link.com/products/details/cat-5258_HS110.html)
- [HS100](http://uk.tp-link.com/products/details/cat-5258_HS100.html)

It is likely that other TPLink models will also work, but these have not been checked.

Installation
------------

[](#installation)

This package can be installed standalone in a regular PHP project, or can also be integrated into Laravel to make life even easier.

To install the latest version simply use composer to add it to your project using the following command:

```
composer require williamson/tplinksmartplug

```

### Laravel Installation/Integration

[](#laravel-installationintegration)

This library supports Laravel's auto discovery feature for auto registering the service provider and facade. If your version of Laravel supports auto discovery, after you have added this package YOU ARE NOW DONE!

If you are using a very old version of Laravel, once this package is installed, you need to register the package's service provider, in `config/app.php`:

```
'providers' => [
    //...
    Williamson\TPLinkSmartplug\Laravel\TPLinkServiceProvider::class,
]
```

##### Facades

[](#facades)

Only if your version of Laravel does NOT support auto discovery then add the following to the aliases section of 'app.php'.

```
'aliases' => [
    //...
    "TPLink" => Williamson\TPLinkSmartplug\Laravel\Facades\TPLinkFacade::class
]
```

##### Config file

[](#config-file)

This package requires a config file so that you can provide the address/details of the TPLink devices you would like to control. To generate this file, run the following command:

```
$ php artisan vendor:publish --provider='Williamson\TPLinkSmartplug\Laravel\TPLinkServiceProvider'

```

This will create a `TPLink.php` file in your Laravel `config` folder. You should edit this to setup your devices.

Configuration
-------------

[](#configuration)

The config file is a very simple array structured file. A config file is required for both standalone/Laravel projects. The content is similar to this:

```
//TPLink.php
