PHPackages                             oguzhantogay/philips-hue-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. [CLI &amp; Console](/categories/cli)
4. /
5. oguzhantogay/philips-hue-client

ActiveLibrary[CLI &amp; Console](/categories/cli)

oguzhantogay/philips-hue-client
===============================

A modern, fully-featured PHP client for Philips Hue smart lights

v1.0.7(8mo ago)05MITPHPPHP ^8.2CI passing

Since Sep 2Pushed 7mo agoCompare

[ Source](https://github.com/oguzhanT/philips-hue-client)[ Packagist](https://packagist.org/packages/oguzhantogay/philips-hue-client)[ Fund](https://www.buymeacoffee.com/OguzhanT)[ GitHub Sponsors](https://github.com/OguzhanT)[ RSS](/packages/oguzhantogay-philips-hue-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (15)Versions (9)Used By (0)

Philips Hue Client for PHP
==========================

[](#philips-hue-client-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/41277b7b5328309534ee5eefcf0138fd1c14ec14051b43bea98c035ee8bfad37/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f67757a68616e746f6761792f7068696c6970732d6875652d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oguzhantogay/philips-hue-client)[![Total Downloads](https://camo.githubusercontent.com/d190f87c59ab41b8720cf59f3f26cb4df4f848d6ac590d18b20bd726582d80ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f67757a68616e746f6761792f7068696c6970732d6875652d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oguzhantogay/philips-hue-client)[![Monthly Downloads](https://camo.githubusercontent.com/9ff3aba80050a31d6349d8f14a30a715a05502a5b3873de6d0776c04aa776059/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6f67757a68616e746f6761792f7068696c6970732d6875652d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oguzhantogay/philips-hue-client)[![PHP Version](https://camo.githubusercontent.com/817df774912140d3ef99c366b9acd5d7fbe65e98e14aa67927f1ff35e0f8a59b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f67757a68616e746f6761792f7068696c6970732d6875652d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oguzhantogay/philips-hue-client)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Stars](https://camo.githubusercontent.com/964b82c7037e35ccca57a58fce4da5e703c7a3272f8fc372dd903b2793777f9b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6f67757a68616e542f7068696c6970732d6875652d636c69656e743f7374796c653d666c61742d737175617265)](https://github.com/oguzhanT/philips-hue-client/stargazers)[![GitHub Forks](https://camo.githubusercontent.com/3622ec1f5b6edb593cbcd8737d89542ec3f094f9da23eb5f42afd90a6c120c69/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6f67757a68616e542f7068696c6970732d6875652d636c69656e743f7374796c653d666c61742d737175617265)](https://github.com/oguzhanT/philips-hue-client/network)[![GitHub Issues](https://camo.githubusercontent.com/afe01d2a4418adb016b7c18e0d757df173c69e4f293761ed2ca14b290f61cf8f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6f67757a68616e542f7068696c6970732d6875652d636c69656e743f7374796c653d666c61742d737175617265)](https://github.com/oguzhanT/philips-hue-client/issues)[![GitHub Pull Requests](https://camo.githubusercontent.com/a39d5a3d81caca9c2478e882919cd4b73e68768875a0e995ba0835a4694f1d00/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6f67757a68616e542f7068696c6970732d6875652d636c69656e743f7374796c653d666c61742d737175617265)](https://github.com/oguzhanT/philips-hue-client/pulls)[![Latest Stable Version](https://camo.githubusercontent.com/b656bf24009d9fc55364406a6244cf4fc23e2c680e8b5ca4d06f623dabf8aa0f/68747470733a2f2f706f7365722e707567782e6f72672f6f67757a68616e746f6761792f7068696c6970732d6875652d636c69656e742f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/oguzhantogay/philips-hue-client)[![Composer Dependencies](https://camo.githubusercontent.com/d0b8d3882d4d83bf4ed5211ac0fd13e85d1a0688eae14f11a809e182569a18d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d7570253230746f253230646174652d627269676874677265656e3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oguzhantogay/philips-hue-client)

A modern, fully-featured PHP client for Philips Hue smart lights. Control lights, rooms, scenes, and schedules with an elegant API. Framework-agnostic with built-in support for Laravel, Symfony, and standalone PHP applications.

✨ Features
----------

[](#-features)

- 🎨 **Complete Hue API v2 Support** - Lights, groups, scenes, schedules, sensors
- 🔍 **Auto Bridge Discovery** - Automatic bridge detection using mDNS/N-UPnP
- 💡 **Intuitive API** - Fluent interface for natural command chaining
- 🎬 **Scene Management** - Create, modify, and activate scenes
- 🎭 **Built-in Effects** - Color loops, breathing, alerts, and custom animations
- ⚡ **Event Streaming** - Real-time updates via Server-Sent Events (SSE)
- 🛠️ **CLI Tool** - Command-line interface for quick control
- 🌐 **REST API Server** - Full REST API with Swagger documentation
- 📦 **Framework Integration** - Ready-made adapters for popular frameworks
- 🧪 **Fully Tested** - Comprehensive test coverage with mocked responses
- 📊 **Resource Monitoring** - Track energy usage and light statistics
- 🔒 **Secure** - Supports Hue's enhanced security mode
- 🚀 **Performance** - Connection pooling, caching, and retry mechanisms
- 🐳 **Docker Ready** - Container support for easy deployment
- 🔄 **Rate Limiting** - Prevents API abuse and protects bridge
- 💾 **Smart Caching** - Automatic caching with configurable TTL

📋 Requirements
--------------

[](#-requirements)

- PHP 8.0 or higher
- Philips Hue Bridge (v2 or newer)
- Network access to Hue Bridge
- ext-json
- ext-curl (optional, for better performance)

🚀 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require oguzhantogay/philips-hue-client
```

🔧 Quick Start
-------------

[](#-quick-start)

### Bridge Discovery &amp; Authentication

[](#bridge-discovery--authentication)

```
use OguzhanTogay\HueClient\HueClient;
use OguzhanTogay\HueClient\Discovery\BridgeDiscovery;

// Auto-discover bridges on your network
$discovery = new BridgeDiscovery();
$bridges = $discovery->discover();

if (empty($bridges)) {
    die("No Hue bridges found on network");
}

$bridge = $bridges[0]; // Use first bridge
echo "Found bridge: {$bridge->getId()} at {$bridge->getIp()}\n";

// Create client and authenticate
$client = new HueClient($bridge->getIp());

// First time setup - press bridge button then run:
$username = $client->register('my-app-name', 'my-device-name');
echo "Save this username: {$username}\n";

// For subsequent connections:
$client = new HueClient($bridgeIp, $username);
```

### Basic Light Control

[](#basic-light-control)

```
// Get all lights
$lights = $client->lights()->getAll();

foreach ($lights as $light) {
    echo "{$light->getName()}: {$light->getState()->getStatus()}\n";
}

// Control specific light
$light = $client->lights()->get(1);

// Simple commands
$light->on();
$light->off();
$light->toggle();

// Set properties
$light->setBrightness(75);  // 0-100%
$light->setColor('#FF5733'); // Hex color
$light->setColorTemperature(2700); // Kelvin (2000-6500)

// Chain commands
$light->on()
     ->setBrightness(100)
     ->setColor('#00FF00')
     ->transition(1000); // 1 second transition
```

### Room/Group Control

[](#roomgroup-control)

```
// Get all rooms
$rooms = $client->groups()->getRooms();

// Control entire room
$livingRoom = $client->groups()->getByName('Living Room');
$livingRoom->on();
$livingRoom->setBrightness(60);
$livingRoom->setScene('Relax');

// Create custom group
$group = $client->groups()->create('Movie Lights', [1, 3, 5]);
$group->setColor('#0000FF')->dim(20);

// Control all lights
$client->groups()->all()->off();
```

### Scenes

[](#scenes)

```
// List available scenes
$scenes = $client->scenes()->getAll();

foreach ($scenes as $scene) {
    echo "{$scene->getName()} - Room: {$scene->getGroup()}\n";
}

// Activate scene
$client->scenes()->activate('Sunset');

// Create custom scene
$scene = $client->scenes()->create(
    name: 'Movie Time',
    lights: [
        1 => ['on' => true, 'brightness' => 30, 'color' => '#0000FF'],
        2 => ['on' => false],
        3 => ['on' => true, 'brightness' => 20, 'color' => '#FF0000']
    ]
);
```

### Advanced Effects

[](#advanced-effects)

```
use OguzhanTogay\HueClient\Effects\ColorLoop;
use OguzhanTogay\HueClient\Effects\Breathing;
use OguzhanTogay\HueClient\Effects\Alert;

// Color loop effect
$effect = new ColorLoop($client);
$effect->start($light, duration: 30); // 30 seconds

// Breathing effect
$breathing = new Breathing($client);
$breathing->start($light, '#FF0000', speed: 'slow');

// Alert flash
$alert = new Alert($client);
$alert->flash($light, times: 3);

// Custom animation
$light->animate([
    ['color' => '#FF0000', 'duration' => 1000],
    ['color' => '#00FF00', 'duration' => 1000],
    ['color' => '#0000FF', 'duration' => 1000],
], repeat: 5);
```

### Schedules

[](#schedules)

```
// Create schedule
$schedule = $client->schedules()->create(
    name: 'Morning Wake Up',
    command: $client->groups()->getByName('Bedroom')->sunrise(duration: 900),
    time: '07:00:00',
    repeat: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday']
);

// One-time schedule
$client->schedules()->once(
    name: 'Party Lights',
    command: $client->groups()->all()->party(),
    dateTime: '2024-12-31 23:00:00'
);

// Sunset/sunrise schedules
$client->schedules()->atSunset(
    command: $client->groups()->getByName('Garden')->on()
);
```

### Real-time Events (SSE)

[](#real-time-events-sse)

```
// Listen for light state changes
$client->events()->listen(function($event) {
    if ($event->getType() === 'light.state_changed') {
        echo "Light {$event->getLightId()} changed\n";
        echo "New state: " . json_encode($event->getData()) . "\n";
    }
});

// Subscribe to specific events
$client->events()->subscribe('motion.detected', function($event) {
    $client->groups()->getByName('Hallway')->on();
});
```

🛠️ CLI Usage
------------

[](#️-cli-usage)

The package includes a powerful CLI tool:

```
# Install globally
composer global require oguzhantogay/philips-hue-client

# Discover bridges
hue discover

# Setup/authenticate
hue setup

# Light control
hue lights                    # List all lights
hue on "Living Room"         # Turn on light
hue off --all               # Turn off all lights
hue brightness 75 "Kitchen"  # Set brightness
hue color "#FF5733" --all   # Set color for all

# Scenes
hue scenes                   # List scenes
hue scene activate "Relax"   # Activate scene

# Effects
hue effect party --duration=30
hue effect sunrise --room="Bedroom" --duration=600

# Interactive mode
hue interactive              # Enter interactive shell
hue server                   # Start REST API server
```

🌐 REST API Server
-----------------

[](#-rest-api-server)

The package includes a full REST API server with Swagger documentation:

### Quick Start

[](#quick-start)

```
# Start the API server
./bin/hue-server --discover

# Or with specific bridge
./bin/hue-server -h 192.168.1.100 -u your-username

# Or using Composer
composer serve

# Or using Docker
docker-compose up
```

The API will be available at:

- **API Base URL**: `http://localhost:8080/api`
- **Swagger Documentation**: `http://localhost:8080/docs`
- **Health Check**: `http://localhost:8080/api/health`

### API Endpoints

[](#api-endpoints)

#### Bridge Management

[](#bridge-management)

- `GET /api/health` - Bridge connectivity status
- `GET /api/bridge/info` - Bridge information
- `GET /api/bridge/config` - Bridge configuration

#### Lights

[](#lights)

- `GET /api/lights` - List all lights
- `GET /api/lights/{id}` - Get specific light
- `PUT /api/lights/{id}/state` - Set light state
- `PATCH /api/lights/{id}/state` - Update light state partially
- `PUT /api/lights/{id}/name` - Rename light

#### Groups &amp; Rooms

[](#groups--rooms)

- `GET /api/groups` - List all groups
- `GET /api/rooms` - List all rooms
- `GET /api/zones` - List all zones
- `GET /api/groups/{id}` - Get specific group
- `POST /api/groups` - Create new group
- `PUT /api/groups/{id}/action` - Control group
- `DELETE /api/groups/{id}` - Delete group

#### Scenes

[](#scenes-1)

- `GET /api/scenes` - List all scenes
- `GET /api/scenes/{id}` - Get specific scene
- `POST /api/scenes` - Create new scene
- `PUT /api/scenes/{id}/activate` - Activate scene
- `DELETE /api/scenes/{id}` - Delete scene

#### Schedules

[](#schedules-1)

- `GET /api/schedules` - List all schedules
- `GET /api/schedules/{id}` - Get specific schedule
- `POST /api/schedules` - Create new schedule
- `PUT /api/schedules/{id}` - Update schedule
- `DELETE /api/schedules/{id}` - Delete schedule

#### Sensors

[](#sensors)

- `GET /api/sensors` - List all sensors
- `GET /api/sensors/{id}` - Get specific sensor
- `PUT /api/sensors/{id}/state` - Update sensor state

### Example API Usage

[](#example-api-usage)

```
# Get all lights
curl http://localhost:8080/api/lights

# Turn on a light
curl -X PUT http://localhost:8080/api/lights/1/state \
  -H "Content-Type: application/json" \
  -d '{"on": true, "brightness": 75}'

# Set light color
curl -X PATCH http://localhost:8080/api/lights/1/state \
  -H "Content-Type: application/json" \
  -d '{"color": "#FF5733"}'

# Control a room
curl -X PUT http://localhost:8080/api/groups/1/action \
  -H "Content-Type: application/json" \
  -d '{"on": true, "brightness": 80, "color": "#00FF00"}'

# Activate a scene
curl -X PUT http://localhost:8080/api/scenes/abc123/activate

# Health check
curl http://localhost:8080/api/health
```

### Environment Configuration

[](#environment-configuration)

Create a `.env` file (copy from `.env.example`):

```
HUE_BRIDGE_IP=192.168.1.100
HUE_USERNAME=your-hue-username
HUE_PORT=8080
CACHE_TTL=300
```

🔌 Framework Integration
-----------------------

[](#-framework-integration)

### 🟠 Laravel Integration

[](#-laravel-integration)

#### Installation &amp; Setup

[](#installation--setup)

```
# Install the package
composer require oguzhantogay/philips-hue-client

# Publish configuration
php artisan vendor:publish --tag=hue-config

# Discover bridges
php artisan hue:discover

# Setup bridge authentication
php artisan hue:setup --discover
```

#### Configuration

[](#configuration)

```
// config/hue.php (auto-published)
return [
    'default' => 'main',
    'bridges' => [
        'main' => [
            'ip' => env('HUE_BRIDGE_IP'),
            'username' => env('HUE_USERNAME'),
            'options' => [
                'timeout' => env('HUE_TIMEOUT', 5),
                'cache_enabled' => env('HUE_CACHE_ENABLED', true),
                'retry_attempts' => env('HUE_RETRY_ATTEMPTS', 3),
            ]
        ],
        // Multiple bridges supported
        'office' => [
            'ip' => env('HUE_BRIDGE_IP_2'),
            'username' => env('HUE_USERNAME_2'),
        ]
    ],
    'auto_discovery' => env('HUE_AUTO_DISCOVERY', true),
];
```

#### Environment Variables

[](#environment-variables)

```
# .env
HUE_BRIDGE_IP=192.168.1.100
HUE_USERNAME=your-bridge-username
HUE_CACHE_ENABLED=true
HUE_CACHE_TYPE=redis
HUE_RETRY_ATTEMPTS=3
HUE_TIMEOUT=5
```

#### Service Provider Registration

[](#service-provider-registration)

```
// config/app.php
'providers' => [
    // ...
    OguzhanTogay\HueClient\Laravel\HueServiceProvider::class,
],

'aliases' => [
    // ...
    'Hue' => OguzhanTogay\HueClient\Laravel\Facades\Hue::class,
],
```

#### Usage Examples

[](#usage-examples)

```
use OguzhanTogay\HueClient\Laravel\Facades\Hue;
use OguzhanTogay\HueClient\HueClient;
use OguzhanTogay\HueClient\ConnectionPool;

// Using Facade
Hue::lights()->getAll();
Hue::groups()->getByName('Living Room')->on();
Hue::scenes()->activate('Movie Time');

// Using Service Container
$hue = app(HueClient::class);
$hue->lights()->get(1)->setColor('#FF5733');

// Multiple Bridges
$pool = app(ConnectionPool::class);
$results = $pool->broadcastToAll(function($client) {
    return $client->groups()->all()->off();
});

// In Controllers
class LightController extends Controller
{
    public function __construct(private HueClient $hue) {}

    public function toggleLight(int $lightId)
    {
        $light = $this->hue->lights()->get($lightId);
        $light->toggle();

        return response()->json([
            'success' => true,
            'light' => $light->getName(),
            'status' => $light->getState()->isOn() ? 'on' : 'off'
        ]);
    }
}

// Background Jobs
class MorningRoutineJob implements ShouldQueue
{
    public function handle(HueClient $hue): void
    {
        $bedroom = $hue->groups()->getByName('Bedroom');
        $bedroom->sunrise(600); // 10 minute sunrise
    }
}

// Event Listeners
class MotionDetectedListener
{
    public function handle(MotionDetected $event, HueClient $hue): void
    {
        $hue->groups()->getByName($event->room)->on();
    }
}
```

#### Artisan Commands

[](#artisan-commands)

```
# Discover bridges
php artisan hue:discover

# Setup bridge authentication
php artisan hue:setup --discover

# Start REST API server
php artisan hue:serve --port=8080

# Clear Hue cache
php artisan cache:clear --tags=hue
```

### 🟡 Symfony Integration

[](#-symfony-integration)

#### Installation &amp; Setup

[](#installation--setup-1)

```
# Install the package
composer require oguzhantogay/philips-hue-client

# Discover bridges
bin/console hue:discover

# Setup bridge authentication
bin/console hue:setup --discover
```

#### Bundle Registration

[](#bundle-registration)

```
// config/bundles.php
return [
    // ...
    OguzhanTogay\HueClient\Symfony\HueBundle::class => ['all' => true],
];
```

#### Configuration

[](#configuration-1)

```
# config/packages/hue.yaml
hue:
    default_bridge: main
    auto_discovery: true

    bridges:
        main:
            ip: '%env(HUE_BRIDGE_IP)%'
            username: '%env(HUE_USERNAME)%'
            options:
                timeout: '%env(int:HUE_TIMEOUT)%'
                cache_enabled: '%env(bool:HUE_CACHE_ENABLED)%'
                retry_attempts: '%env(int:HUE_RETRY_ATTEMPTS)%'

        office:
            ip: '%env(HUE_BRIDGE_IP_2)%'
            username: '%env(HUE_USERNAME_2)%'

    cache:
        adapter: redis
        ttl:
            lights: 10
            groups: 30
            scenes: 60

    api:
        enabled: true
        port: 8080
        rate_limit: 100
```

#### Environment Variables

[](#environment-variables-1)

```
# .env
HUE_BRIDGE_IP=192.168.1.100
HUE_USERNAME=your-bridge-username
HUE_CACHE_ENABLED=true
HUE_CACHE_TYPE=redis
HUE_RETRY_ATTEMPTS=3
HUE_TIMEOUT=5
```

#### Service Usage

[](#service-usage)

```
// In Controllers
use OguzhanTogay\HueClient\HueClient;
use OguzhanTogay\HueClient\ConnectionPool;

class LightController extends AbstractController
{
    public function __construct(
        private HueClient $hueClient,
        private ConnectionPool $connectionPool
    ) {}

    #[Route('/lights', methods: ['GET'])]
    public function lights(): JsonResponse
    {
        $lights = $this->hueClient->lights()->getAll();

        return $this->json(array_map(function($light) {
            return [
                'id' => $light->getId(),
                'name' => $light->getName(),
                'state' => $light->getState()->toArray()
            ];
        }, $lights));
    }

    #[Route('/lights/{id}/toggle', methods: ['POST'])]
    public function toggleLight(int $id): JsonResponse
    {
        $light = $this->hueClient->lights()->get($id);
        $light->toggle();

        return $this->json([
            'success' => true,
            'status' => $light->getState()->isOn() ? 'on' : 'off'
        ]);
    }
}

// In Services
#[AsAlias('app.hue_service')]
class HueService
{
    public function __construct(private HueClient $hueClient) {}

    public function createMoodLighting(string $room, string $mood): void
    {
        $group = $this->hueClient->groups()->getByName($room);

        match($mood) {
            'relax' => $group->setColor('#FF8C00')->setBrightness(30),
            'focus' => $group->setColor('#FFFFFF')->setBrightness(90),
            'party' => $group->setColor('#FF00FF')->setBrightness(100),
            default => $group->on()
        };
    }
}

// Event Subscribers
class HueEventSubscriber implements EventSubscriberInterface
{
    public function __construct(private HueClient $hueClient) {}

    public static function getSubscribedEvents(): array
    {
        return [
            'app.user_arrived_home' => 'onUserArrivedHome',
            'app.bedtime' => 'onBedtime',
        ];
    }

    public function onUserArrivedHome(): void
    {
        $this->hueClient->scenes()->activate('Welcome Home');
    }

    public function onBedtime(): void
    {
        $this->hueClient->groups()->all()->sunset(300);
    }
}
```

#### Console Commands

[](#console-commands)

```
# Discover bridges
bin/console hue:discover

# Setup bridge authentication
bin/console hue:setup --discover

# Start REST API server
bin/console hue:serve --port=8080

# Clear cache
bin/console cache:clear
```

### Standalone/Vanilla PHP

[](#standalonevanilla-php)

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

$config = [
    'bridge_ip' => '192.168.1.100',
    'username' => 'your-username'
];

$hue = new \OguzhanTogay\HueClient\HueClient(
    $config['bridge_ip'],
    $config['username']
);
```

🐳 Docker Development
--------------------

[](#-docker-development)

### Quick Start with Docker

[](#quick-start-with-docker)

```
# Clone the repository
git clone https://github.com/oguzhanT/philips-hue-client.git
cd philips-hue-client

# Copy environment file
cp .env.example .env

# Edit .env with your bridge IP and username
nano .env

# Start with Docker Compose
docker-compose up -d

# View logs
docker-compose logs -f hue-api
```

### Development Environment

[](#development-environment)

```
# Development environment with hot reload
docker-compose -f docker-compose.dev.yml up

# Run tests in container
docker-compose exec dev composer test

# Access shell
docker-compose exec dev sh
```

🧪 Testing
---------

[](#-testing)

```
# Run tests
composer test

# Run tests with coverage
composer test-coverage

# Run static analysis
composer analyse

# Run API tests
composer test -- tests/Api/

# Test with Docker
docker-compose exec dev composer test
```

🚀 Performance Features
----------------------

[](#-performance-features)

### Connection Pooling

[](#connection-pooling)

```
use OguzhanTogay\HueClient\ConnectionPool;

$pool = new ConnectionPool();
$pool->addBridge('192.168.1.100', 'username1');
$pool->addBridge('192.168.1.101', 'username2');

// Health check all bridges
$health = $pool->healthCheck();

// Broadcast action to all bridges
$results = $pool->broadcastToAll(function($client) {
    return $client->groups()->all()->on();
});
```

### Caching &amp; Retry

[](#caching--retry)

```
$client = new HueClient($bridgeIp, $username, [
    'cache_enabled' => true,
    'cache_type' => 'redis', // or 'filesystem'
    'retry_attempts' => 5,
    'timeout' => 10
]);

// Automatic caching and retry on failures
$lights = $client->lights()->getAll(); // Cached for 10 seconds
```

### Rate Limiting

[](#rate-limiting)

The REST API automatically rate limits requests to protect your bridge:

- **Limit**: 100 requests per minute per IP
- **Headers**: `X-RateLimit-Limit`, `X-RateLimit-Remaining`
- **Error**: HTTP 429 when exceeded

📊 Examples
----------

[](#-examples)

Check the `/examples` directory for complete examples:

### Basic Examples

[](#basic-examples)

- `basic-control.php` - Simple light control
- `party-mode.php` - Multi-room party effects
- `rest-api-client.php` - REST API usage examples
- `working-example.php` - Complete working example
- `interactive-test.php` - Interactive testing

### Framework Integration Examples

[](#framework-integration-examples)

- `laravel-controller.php` - Laravel controller integration
- `symfony-controller.php` - Symfony controller integration

### Creative &amp; Advanced Examples

[](#creative--advanced-examples)

- `music-sync-party.php` - 🎵 Music-synchronized party lighting with beat detection
- `security-system.php` - 🔒 Home security integration with motion alerts
- `gaming-mood-lighting.php` - 🎮 Gaming lighting with health bars and achievements
- `weather-based-lighting.php` - 🌤️ Weather-responsive ambient lighting
- `biometric-health-integration.php` - 💊 Health monitoring with biometric data
- `smart-home-automation.php` - 🏠 Complete smart home automation hub

🌟 Community Showcase
--------------------

[](#-community-showcase)

**Built something awesome?** Share it with us!

ProjectDescriptionAuthor[Hue DJ Controller](link)Sync lights with DJ mixer@username[Smart Office Bot](link)Slack bot for office lighting@username[Gaming Immersion](link)React to game events@username[➕ Add your project](https://github.com/oguzhanT/philips-hue-client/discussions/new?category=show-and-tell)

💬 Join the Discussion
---------------------

[](#-join-the-discussion)

- 🐛 [Report bugs](https://github.com/oguzhanT/philips-hue-client/issues/new?template=bug_report.md)
- 💡 [Request features](https://github.com/oguzhanT/philips-hue-client/issues/new?template=feature_request.md)
- 💬 [General discussion](https://github.com/oguzhanT/philips-hue-client/discussions)
- 🆘 [Get help](https://github.com/oguzhanT/philips-hue-client/discussions/categories/q-a)

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

🔗 Links
-------

[](#-links)

- [Philips Hue API Documentation](https://developers.meethue.com/)
- [Report Issues](https://github.com/oguzhanT/philips-hue-client/issues)
- [Packagist](https://packagist.org/packages/oguzhantogay/philips-hue-client)

💖 Support
---------

[](#-support)

If you find this package useful, please consider:

- ⭐ Starring the repository
- 🐛 Reporting bugs
- 💡 Suggesting new features
- 🍺 [Buying me a coffee](https://www.buymeacoffee.com/oguzhanT)

---

Made with ❤️ by [Oguzhan Togay](https://github.com/oguzhanT)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance62

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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 ~1 days

Total

8

Last Release

247d ago

PHP version history (2 changes)v1.0.0PHP ^8.0

v1.0.7PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0121e5094695539205ee3f81b5ba7fa8bb6e66d9237d8bbc03329da311643a23?d=identicon)[oguzhanT](/maintainers/oguzhanT)

---

Top Contributors

[![oguzhanT](https://avatars.githubusercontent.com/u/6030989?v=4)](https://github.com/oguzhanT "oguzhanT (1 commits)")

---

Tags

api-clientautomationclicomposerdeveloper-toolshome-automationlaravelphilips-huephpreal-timesmart-hometerminalphpclisymfonylaravelapi clientiothuephilipshome automationsmart-lights

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/oguzhantogay-philips-hue-client/health.svg)

```
[![Health](https://phpackages.com/badges/oguzhantogay-philips-hue-client/health.svg)](https://phpackages.com/packages/oguzhantogay-philips-hue-client)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k48](/packages/nunomaduro-laravel-console-menu)[nunomaduro/laravel-console-task

Laravel Console Task is a output method for your Laravel/Laravel Zero commands.

2582.1M11](/packages/nunomaduro-laravel-console-task)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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