webproject-xyz / ikea-tradfri-php-api
PHP library to control ikea tradfri hub
Installs: 46
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 1
Forks: 2
Open Issues: 7
pkg:composer/webproject-xyz/ikea-tradfri-php-api
Requires
- php: ~8.3.0 || ~8.4.0 || ~8.5.0
- ext-filter: *
- ext-json: *
- ext-mbstring: *
- doctrine/collections: ^2.6.0
- psr/log: ^3.0.2
- roave/better-reflection: ^6.69.0
- symfony/polyfill-mbstring: ^1.33.0
- symfony/process: ^7.4.5
- symfony/property-access: ^7.4.4
- symfony/property-info: ^7.4.5
- symfony/serializer: ^7.4.5
- symfony/service-contracts: ^3.6.1
- symfony/validator: ^7.4.5
- webmozart/assert: ^2.1.5
Requires (Dev)
- codeception/codeception: ^5.3.5
- codeception/mockery-module: ^0.5.0
- codeception/module-asserts: ^3.3.0
- ergebnis/license: ^2.7.0
- ergebnis/php-cs-fixer-config: ^6.60.1
- friendsofphp/php-cs-fixer: ^3.94.2
- maglnet/composer-require-checker: ^4.20.0
- mockery/mockery: ^1.6.12
- phpro/grumphp: ^2.19.0
- phpstan/extension-installer: ^1.4.3
- phpstan/phpdoc-parser: ^2.3.2
- phpstan/phpstan: ^2.1.40
- phpstan/phpstan-doctrine: ^2.0.18
- phpstan/phpstan-mockery: ^2.0.0
- phpunit/phpunit: ^12.5.14
- rector/rector: ^2.3.8
- roave/security-advisories: dev-latest
- symfony/var-dumper: ^7.4.4
- wmde/psr-log-test-doubles: ^3.4.0
- dev-main
- 4.1.6
- 4.1.5
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 3.1.x-dev
- 3.1.0
- 3.0.1
- 3.0.0
- 2.6.x-dev
- 2.6.0
- 2.5.x-dev
- 2.5.1
- 2.5.0
- 2.4.x-dev
- 2.4.0
- 2.3.x-dev
- 2.3.1
- 2.3.0
- 2.2.x-dev
- 2.2.0
- 2.1.0
- 2.0.0
- 1.0.0
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- dev-renovate/major-symfony
- dev-renovate/major-php-dev-tools
- dev-renovate/doctrine-collections-3.x
- dev-renovate/major-github-actions
- dev-renovate/github-actions
- dev-renovate/lock-file-maintenance
This package is auto-updated.
Last update: 2026-02-26 10:37:37 UTC
README
A powerful PHP library to control IKEA Tradfri smart lights via the Gateway.
🚀 Quick Start
1. Requirements
- PHP 8.3+
coap-client(available via Docker)
2. Generate Security Key
Use the Docker Coap-Client to get your credentials:
docker run --rm webproject/coap-client -m post -u "Client_identity" -k "<GATEWAY_SECRET>" -e '{"9090":"php-api-user"}' "coaps://<GATEWAY_IP>:5684/15011/9063"
💻 Usage
Initialize API
use IKEA\Tradfri\Dto\CoapGatewayAuthConfigDto; use IKEA\Tradfri\Factory\GatewayServiceFactory; $api = (new GatewayServiceFactory( new CoapGatewayAuthConfigDto( username: 'php-api-user', apiKey: 'GENERATED_API_KEY', gatewayIp: '192.168.1.10', gatewaySecret: 'GATEWAY_SECRET' ) ))();
Control Devices
// Switch on all lights and dim to 80% foreach ($api->getLights() as $light) { $light->switchOn()->dim(80); } // Switch off a specific group $api->getGroups()->first()?->switchOff();
📖 Documentation
🤝 Contributing
Feel free to submit Pull Requests.
📄 License
MIT License.