Download the latest version of KarotzPhp and add the Karotz namespace to your PSR-0 autoloading system, or simply require the autoload.php
{"require":{"karotz/karotz": ">=1.0.0-alpha" } }useKarotz\Karotz; $kz = newKarotz('Interactive ID'); try{// Make flash your Karotz LED in red$response = $kz->ledPulse('FF0000', 500, 500); // Test the responseif ($response->getStatus()) echo"Rabbit flashs red light!"; elseecho$response->getCode().": ".$response->getDescription()} catch(\Exception$e){echo$e->getMessage()}To run, the Karotz REST API needs an Interactive ID, which is reset every 15 minutes. Check the official documentation to know how retrieve this ID. http://dev.karotz.com/api/interactiveid.html KarotzPhp is not involved in managing the life cycle of the Interactive ID, but provides a way to get it with the signed START method:
useKarotz\Karotz; $kz = newKarotz(); // Open a session and save the Interactive ID in the Karotz object$response = $kz->start('install ID', 'API key', 'secret key');Work in progress... waiting for some test
- Any flavor of PHP 5.3 should do
- Jeremy Perret [email protected]
- Thierry Geindre [email protected]
KarotzPhp is licensed under the MIT License - see the LICENSE file for details