PHPackages                             gared/shelly-php-client - 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. gared/shelly-php-client

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

gared/shelly-php-client
=======================

Client to access HTTP API of shelly devices

2.1.0(1y ago)114481[1 issues](https://github.com/Gared/shelly-php-client/issues)MITPHPPHP &gt;=8.1

Since Jan 25Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Gared/shelly-php-client)[ Packagist](https://packagist.org/packages/gared/shelly-php-client)[ RSS](/packages/gared-shelly-php-client/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (9)Versions (5)Used By (0)

shelly-php-client
=================

[](#shelly-php-client)

You can use this library to access the HTTP API of a Shelly device. You can find the official API documentation [here](https://shelly-api-docs.shelly.cloud).

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

[](#installation)

Use composer

```
composer require gared/shelly-php-client
```

Getting started
---------------

[](#getting-started)

### Configure client

[](#configure-client)

```
$client = new \ShellyClient\HTTP\Client('http://192.168.1.10');
```

If you have configured login credentials you have to create the client like this:

```
$client = new \ShellyClient\HTTP\Client('http://shellyuser:secret@192.168.1.10');
```

### Get current power usage

[](#get-current-power-usage)

```
$meter = $client->getMeter(new \ShellyClient\Model\Request\MeterRequest());
$power = $meter->getPower();
echo "Current power usage: " . $power;
```

### Power shelly plug "on"

[](#power-shelly-plug-on)

```
$client->getRelay(0, \ShellyClient\Model\Request\RelayRequest::TURN_ON);
```

### Full example

[](#full-example)

```
// Create new client for one device
$clientLightA = new \ShellyClient\HTTP\Client('http://192.168.1.10', 'ShellyDeviceLightA');
$clientLightB = new \ShellyClient\HTTP\Client('http://192.168.1.20', 'ShellyDeviceLightB');

// Switch device on and get relay data
$relayRequest = new \ShellyClient\Model\Request\RelayRequest();
$relayRequest->setRelayIndex(0);
$relayRequest->setTurn(\ShellyClient\Model\Request\RelayRequest::TURN_ON);
$relay = $clientLightA->getRelay($relayRequest);
// check if timer has been set
if ($relay->hasTimer()) {
    // do something
}

$meter = $clientLightA->getMeter(new \ShellyClient\Model\Request\MeterRequest());
// Get total power consumption in kW/h
$kilowattHours = $meter->getTotalInKilowattHours();
// Get last three watt per minute power consumption values
$counters = $meter->getCounters();

// Parallel call informations from device B
$power = $clientLightB->getMeter(new \ShellyClient\Model\Request\MeterRequest())->getPower();
// Get device name set above in construct
$deviceNameDeviceB = $clientLightB->getDeviceName();
// or use device name set in shelly device
$deviceNameShelly = $clientLightB->getSettings(new \ShellyClient\Model\Request\SettingsRequest())->getName();
```

Supported Platforms
-------------------

[](#supported-platforms)

- You need at least PHP 8.1

Supported APIs
--------------

[](#supported-apis)

APICode/light$client-&gt;getLight();/meter$client-&gt;getMeter();/relay$client-&gt;getRelay();/settings$client-&gt;getSettings();/settings/actions$client-&gt;getActions();/settings/light$client-&gt;getSettingsLight();/status$client-&gt;getStatus();

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~439 days

Total

4

Last Release

666d ago

Major Versions

1.0.0 → 2.0.02021-04-10

PHP version history (2 changes)1.0.0PHP &gt;=7.4

2.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/fe880ade7a73b9be4c0eef970996af088c993f0b4e2af8f86cbb91b93b51461d?d=identicon)[gared](/maintainers/gared)

---

Top Contributors

[![Gared](https://avatars.githubusercontent.com/u/913630?v=4)](https://github.com/Gared "Gared (41 commits)")

---

Tags

clientlibraryphpshelly

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gared-shelly-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/gared-shelly-php-client/health.svg)](https://phpackages.com/packages/gared-shelly-php-client)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M507](/packages/pimcore-pimcore)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[api-platform/symfony

Symfony API Platform integration

384.5M129](/packages/api-platform-symfony)[api-platform/serializer

API Platform core Serializer

274.8M87](/packages/api-platform-serializer)

PHPackages © 2026

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