├── .gitignore ├── .github └── dependabot.yml ├── composer.json ├── LICENSE.md ├── src ├── Plugs.php ├── Lights.php └── Connect.php ├── README.md └── composer.lock /.gitignore: -------------------------------------------------------------------------------- 1 | composer.phar 2 | /vendor/ 3 | tests.php -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for Composer 4 | - package-ecosystem: "composer" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | versioning-strategy: increase-if-necessary 9 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dutchie027/govee", 3 | "description": "A simple PHP package for controlling Govee Wi-Fi systems via their API", 4 | "keywords": ["php", "home automation", "govee", "lights", "plugs"], 5 | "license": "MIT", 6 | "type": "library", 7 | "require": { 8 | "guzzlehttp/guzzle": "^7.2", 9 | "monolog/monolog": "^2.1" 10 | }, 11 | "autoload": { 12 | "psr-4": { 13 | "dutchie027\\govee\\": "src/" 14 | } 15 | }, 16 | "support": { 17 | "forum": "https://github.com/dutchie027/govee-api/discussions", 18 | "issues": "https://github.com/dutchie027/govee-api/issues", 19 | "source": "https://github.com/dutchie027/govee-api/tree/main" 20 | }, 21 | "authors": [{ 22 | "name": "Justin Rodino", 23 | "email": "justin@227volts.com" 24 | }] 25 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2020 Justin Rodino 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/Plugs.php: -------------------------------------------------------------------------------- 1 | client = $client; 17 | $this->getPlugs(); 18 | } 19 | 20 | /** 21 | * turnOn 22 | * Turns A Plug On based on MAC or Name ($device) 23 | * 24 | * @param string $device 25 | * 26 | * @return string 27 | * 28 | */ 29 | public function turnOn($device) 30 | { 31 | $mac = $this->getDeviceMAC($device); 32 | $data['headers'] = $this->client->setHeaders(); 33 | $body['device'] = $mac; 34 | $body['model'] = $this->model_array[$mac]; 35 | $body['cmd']['name'] = "turn"; 36 | $body['cmd']['value'] = "on"; 37 | $data['body'] = json_encode($body); 38 | 39 | $response = $this->client->client->request('PUT', $this->client::DEVICE_CONTROL, $data); 40 | $this->client->setRateVars($response->getHeaders()); 41 | return $response->getBody(); 42 | } 43 | 44 | /** 45 | * turnOff 46 | * Turns A Plug Off based on MAC or Name ($device) 47 | * 48 | * @param string $device 49 | * 50 | * @return string 51 | * 52 | */ 53 | public function turnOff($device) 54 | { 55 | $mac = $this->getDeviceMAC($device); 56 | $data['headers'] = $this->client->setHeaders(); 57 | $body['device'] = $mac; 58 | $body['model'] = $this->model_array[$mac]; 59 | $body['cmd']['name'] = "turn"; 60 | $body['cmd']['value'] = "off"; 61 | $data['body'] = json_encode($body); 62 | 63 | $response = $this->client->client->request('PUT', $this->client::DEVICE_CONTROL, $data); 64 | $this->client->setRateVars($response->getHeaders()); 65 | return $response->getBody(); 66 | } 67 | 68 | /** 69 | * getDeviceMAC 70 | * Takes $device and returns the associated MAC address 71 | * 72 | * @param int $device 73 | * 74 | * @return string 75 | * 76 | */ 77 | private function getDeviceMAC($device) 78 | { 79 | if (preg_match('/^([a-fA-F0-9]{2}\:){7}[a-fA-F0-9]{2}$/', $device)) { 80 | return $device; 81 | } else { 82 | if (in_array($device, $this->mac_array)) { 83 | return $this->name_array[$device]; 84 | } else { 85 | die("Device Not Found"); 86 | } 87 | } 88 | } 89 | 90 | /** 91 | * getPlugs 92 | * Called by the constructor. Pre-Loads arrays/hashes to reference 93 | * a plug by either MAC address or name 94 | * 95 | * 96 | * @return void 97 | * 98 | */ 99 | private function getPlugs() 100 | { 101 | $all_devices = $this->client->getDeviceList(); 102 | foreach ($all_devices as $device) { 103 | if (!in_array("color", $device['supportCmds'])) { 104 | $name = $device['deviceName']; 105 | $mac = $device['device']; 106 | $model = $device['model']; 107 | $this->name_array[$name] = $mac; 108 | $this->mac_array[$mac] = $name; 109 | $this->model_array[$mac] = $model; 110 | } 111 | } 112 | } 113 | 114 | /** 115 | * getDeviceState 116 | * Gets the State of a Single Device and returns a JSON Payload 117 | * 118 | * @param string $device 119 | * 120 | * @return string 121 | * 122 | */ 123 | public function getDeviceState($device) 124 | { 125 | $mac = $this->getDeviceMAC($device); 126 | $url = $this->client::DEVICE_STATE . "?device=" . $mac . "&model=" . $this->model_array[$mac]; 127 | $response = $this->client->makeAPICall("GET", $url); 128 | return $response->getBody(); 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/Lights.php: -------------------------------------------------------------------------------- 1 | client = $client; 17 | $this->getLights(); 18 | } 19 | 20 | /** 21 | * turnOn 22 | * Turns A Light On based on MAC or Name ($device) 23 | * 24 | * @param string $device 25 | * 26 | * @return string 27 | * 28 | */ 29 | public function turnOn($device) 30 | { 31 | $mac = $this->getDeviceMAC($device); 32 | $data['headers'] = $this->client->setHeaders(); 33 | $body['device'] = $mac; 34 | $body['model'] = $this->model_array[$mac]; 35 | $body['cmd']['name'] = "turn"; 36 | $body['cmd']['value'] = "on"; 37 | $data['body'] = json_encode($body); 38 | 39 | $response = $this->client->client->request('PUT', $this->client::DEVICE_CONTROL, $data); 40 | $this->client->setRateVars($response->getHeaders()); 41 | return $response->getBody(); 42 | } 43 | 44 | /** 45 | * turnOff 46 | * Turns A Light Off based on MAC or Name ($device) 47 | * 48 | * @param string $device 49 | * 50 | * @return string 51 | * 52 | */ 53 | public function turnOff($device) 54 | { 55 | $mac = $this->getDeviceMAC($device); 56 | $data['headers'] = $this->client->setHeaders(); 57 | $body['device'] = $mac; 58 | $body['model'] = $this->model_array[$mac]; 59 | $body['cmd']['name'] = "turn"; 60 | $body['cmd']['value'] = "off"; 61 | $data['body'] = json_encode($body); 62 | 63 | $response = $this->client->client->request('PUT', $this->client::DEVICE_CONTROL, $data); 64 | $this->client->setRateVars($response->getHeaders()); 65 | return $response->getBody(); 66 | } 67 | 68 | /** 69 | * getDeviceMAC 70 | * Takes $device and returns the associated MAC address 71 | * 72 | * @param int $device 73 | * 74 | * @return string 75 | * 76 | */ 77 | private function getDeviceMAC($device) 78 | { 79 | if (preg_match('/^([a-fA-F0-9]{2}\:){7}[a-fA-F0-9]{2}$/', $device)) { 80 | return $device; 81 | } else { 82 | if (in_array($device, $this->mac_array)) { 83 | return $this->name_array[$device]; 84 | } else { 85 | die("Device Not Found"); 86 | } 87 | } 88 | } 89 | 90 | /** 91 | * getLights 92 | * Called by the constructor. Pre-Loads arrays/hashes to reference 93 | * lights by either MAC address or name 94 | * 95 | * 96 | * @return void 97 | * 98 | */ 99 | private function getLights() 100 | { 101 | $all_devices = $this->client->getDeviceList(); 102 | foreach ($all_devices as $device) { 103 | if (in_array("color", $device['supportCmds'])) { 104 | $name = $device['deviceName']; 105 | $mac = $device['device']; 106 | $model = $device['model']; 107 | $this->name_array[$name] = $mac; 108 | $this->mac_array[$mac] = $name; 109 | $this->model_array[$mac] = $model; 110 | } 111 | } 112 | } 113 | 114 | /** 115 | * setBrightness 116 | * Sets brightness based on MAC or Name ($device) and Brigthness Level ($bl) 117 | * 118 | * @param string $device 119 | * @param int $bl 120 | * 121 | * @return string 122 | * 123 | */ 124 | public function setBrightness($device, $bl) 125 | { 126 | if (!is_numeric($bl) || $bl > 100 || $bl < 0) { 127 | die("Brigthness must be numeric between 0 and 100"); 128 | } 129 | $mac = $this->getDeviceMAC($device); 130 | $body['device'] = $mac; 131 | $body['model'] = $this->model_array[$mac]; 132 | $body['cmd']['name'] = "brightness"; 133 | $body['cmd']['value'] = $bl; 134 | 135 | $response = $this->client->makeAPICall("PUT", $this->client::DEVICE_CONTROL, json_encode($body)); 136 | return $response->getBody(); 137 | } 138 | 139 | /** 140 | * setTemp 141 | * Sets light temperature based on MAC or Name ($device) and temperature level ($tl) 142 | * 143 | * @param string $device 144 | * @param int $tl 145 | * 146 | * @return string 147 | * 148 | */ 149 | public function setTemp($device, $tl) 150 | { 151 | if (!is_numeric($tl) || $tl > 9000 || $tl < 2000) { 152 | die("Brigthness must be numeric between 2000 and 9000"); 153 | } 154 | $mac = $this->getDeviceMAC($device); 155 | 156 | $body['device'] = $mac; 157 | $body['model'] = $this->model_array[$mac]; 158 | $body['cmd']['name'] = "colorTem"; 159 | $body['cmd']['value'] = $tl; 160 | 161 | $response = $this->client->makeAPICall("PUT", $this->client::DEVICE_CONTROL, json_encode($body)); 162 | return $response->getBody(); 163 | } 164 | 165 | /** 166 | * setColor 167 | * Sets the RGB Color of a strand of lights based on MAC or Name ($device) and RGB 168 | * 169 | * @param string $device 170 | * @param int $r 171 | * @param int $g 172 | * @param int $b 173 | * 174 | * @return string 175 | * 176 | */ 177 | public function setColor($device, $r, $g, $b) 178 | { 179 | $mac = $this->getDeviceMAC($device); 180 | $body['device'] = $mac; 181 | $body['model'] = $this->model_array[$mac]; 182 | $body['cmd']['name'] = "color"; 183 | $body['cmd']['value']['r'] = $r; 184 | $body['cmd']['value']['g'] = $g; 185 | $body['cmd']['value']['b'] = $b; 186 | $response = $this->client->makeAPICall("PUT", $this->client::DEVICE_CONTROL, json_encode($body)); 187 | return $response->getBody(); 188 | } 189 | 190 | /** 191 | * getDeviceState 192 | * Gets the State of a Single Device and returns a JSON Payload 193 | * 194 | * @param string $device 195 | * 196 | * @return string 197 | * 198 | */ 199 | public function getDeviceState($device) 200 | { 201 | $mac = $this->getDeviceMAC($device); 202 | $url = $this->client::DEVICE_STATE . "?device=" . $mac . "&model=" . $this->model_array[$mac]; 203 | $response = $this->client->makeAPICall("GET", $url); 204 | return $response->getBody(); 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Govee PHP API 2 | 3 | [![Latest Stable Version](https://poser.pugx.org/dutchie027/govee/v)](//packagist.org/packages/dutchie027/govee) 4 | [![Total Downloads](https://poser.pugx.org/dutchie027/govee/downloads)](//packagist.org/packages/dutchie027/govee) 5 | [![License](https://poser.pugx.org/dutchie027/govee/license)](//packagist.org/packages/dutchie027/govee) 6 | [![CodeFactor](https://www.codefactor.io/repository/github/dutchie027/govee-api/badge)](https://www.codefactor.io/repository/github/dutchie027/govee-api) 7 | 8 | A simple PHP package that allows you to control [Govee Smart Lights](https://www.govee.com/) using their [API](https://govee-public.s3.amazonaws.com/developer-docs/GoveeAPIReference.pdf). 9 | 10 | ## Requirements 11 | 12 | * PHP >7.2 13 | 14 | ## Installation 15 | 16 | You can install the package using the [Composer](https://getcomposer.org/) package manager. You can install it by running this command in your project root: 17 | 18 | ```sh 19 | composer require dutchie027/govee 20 | ``` 21 | 22 | ## Basic Usage 23 | 24 | ### Instantiate the client 25 | 26 | To use any of the Govee API functions, you first need a connection reference. The connection refrence can then be fed to either the Lights library or the Plugs library, or even both if you have both Govee Lights and Plugs. 27 | 28 | ```php 29 | // Ensure we have the composer libraries 30 | require_once ('vendor/autoload.php'); 31 | 32 | // Instantiate with defaults 33 | $govee = new dutchie027\govee\Connect("GOVEE-API-KEY"); 34 | 35 | // Instantiate without defaults, this allows you to change things 36 | // like log location, directory, the tag and possible future settings. 37 | $settings = [ 38 | 'log_dir' => '/tmp', 39 | 'log_name' => 'govee-api', 40 | 'log_tag' => 'mylights', 41 | 'log_level' => 'error' 42 | ]; 43 | 44 | $govee = new dutchie027\govee\Connect("GOVEE-API-KEY", $settings); 45 | ``` 46 | 47 | #### Settings 48 | 49 | The default settings are fine, however you might want to override the defaults or use your own.**NOTE: All settings are optional and you don't need to provide any**. 50 | 51 | Field | Type | Description | Default Value 52 | ----- | ---- | ----------- | ------------- 53 | `log_dir` | string | The directory where the log file is stored | [sys_get_temp_dir()](https://www.php.net/manual/en/function.sys-get-temp-dir.php) 54 | `log_name` | string | The name of the log file that is created in `log_dir`. If you don't put .log at the end, it will append it | 6 random characters + [time()](https://www.php.net/manual/en/function.time.php) + .log 55 | `log_tag` | string | If you share this log file with other applications, this is the tag used in the log file | govee 56 | `log_level` | string | The level of logging the application will do. This must be either `debug`, `info`, `notice`, `warning`, `critical` or `error`. If it is not one of those values it will fail to the default | `warning` 57 | 58 | ## Connect (Core) Functions 59 | 60 | ### Get Device Count 61 | 62 | ```php 63 | print $govee->getDeviceCount(); 64 | ``` 65 | 66 | ### Get An Array of All Devices 67 | 68 | ```php 69 | $array = $govee->getDeviceList(); 70 | ``` 71 | 72 | #### Example Return Array 73 | 74 | ```json 75 | Array 76 | ( 77 | [0] => Array 78 | ( 79 | [device] => 46:F1:CC:F6:FC:65:FF:AA 80 | [model] => H6159 81 | [deviceName] => Office-Color 82 | [controllable] => 1 83 | [retrievable] => 1 84 | [supportCmds] => Array 85 | ( 86 | [0] => turn 87 | [1] => brightness 88 | [2] => color 89 | [3] => colorTem 90 | ) 91 | 92 | ) 93 | 94 | ) 95 | ``` 96 | 97 | ### Get An Array of All Callable MAC Addresses 98 | 99 | ```php 100 | $macArray = $govee->getDeviceMACArray(); 101 | ``` 102 | 103 | #### MAC Return Array 104 | 105 | ```php 106 | Array 107 | ( 108 | [0] => A9:E9:0A:04:AD:CD:12:34 109 | [1] => FA:8F:50:B2:AD:A7:00:12 110 | [2] => E0:94:41:AC:62:13:56:78 111 | ) 112 | ``` 113 | 114 | ### Get An Array of All Device Names 115 | 116 | ```php 117 | $nameArray = $govee->getDeviceNameArray(); 118 | ``` 119 | 120 | #### Device Name Return Array 121 | 122 | ```php 123 | Array 124 | ( 125 | [0] => My-Living-Room 126 | [1] => Hallway 127 | [2] => Fire-House 128 | ) 129 | ``` 130 | 131 | ### Get the location of the log file 132 | 133 | ```php 134 | print $govee->getLogLocation(); 135 | ``` 136 | 137 | #### Example Return String 138 | 139 | ```txt 140 | /tmp/2Zo46b.1607566740.log 141 | ``` 142 | 143 | ## Lights Functions 144 | 145 | ### Controlling Lights 146 | 147 | To control lights, you first need to make a connection and then reference the connection 148 | 149 | ```php 150 | // Ensure we have the composer libraries 151 | require_once ('vendor/autoload.php'); 152 | 153 | // Instantiate with defaults 154 | $govee = new dutchie027\govee\Connect("GOVEE-API-KEY"); 155 | 156 | ``` 157 | 158 | Once you've got a reference to the lights, it will preload all of the MAC Address(es) and name(s) of the devices. 159 | 160 | #### Turning A Light ON 161 | 162 | To turn a light on, simply feed it the MAC address or the name of the light. 163 | 164 | ```php 165 | $govee->lights()->turnOn("AC:14:A3:D5:E6:C4:3D:AE"); 166 | 167 | or 168 | 169 | $govee->lights()->turnOn("Office-Wall"); 170 | ``` 171 | 172 | #### Turning A Light OFF 173 | 174 | Like turning a light on, to turn a light off, simply feed the MAC address or the name of the light. 175 | 176 | ```php 177 | $govee->lights()->turnOff("AC:14:A3:D5:E6:C4:3D:AE"); 178 | 179 | or 180 | 181 | $govee->lights()->turnOff("Office-Wall"); 182 | ``` 183 | 184 | #### Adjusting BRIGHTNESS of A Light 185 | 186 | To adjust the brigthness, simply give the name or MAC and the brightness, an INT between 0 and 100. 187 | 188 | ```php 189 | $govee->lights()->setBrightness("AC:14:A3:D5:E6:C4:3D:AE", 75); 190 | 191 | or 192 | 193 | $govee->lights()->setBrightness("Office-Wall", 75); 194 | ``` 195 | 196 | #### Changing the COLOR of A Light 197 | 198 | To adjust the color, simply give the name or MAC and the brightness and then feed the R, G, B colors you'd like the device to set itself to. *NOTE* the values for Red, Green and Blue must be between 0 and 255. 199 | 200 | ```php 201 | $govee->lights()->setColor("AC:14:A3:D5:E6:C4:3D:AE", 255, 255, 0); 202 | 203 | or 204 | 205 | $govee->lights()->setBrightness("Office-Wall", 255, 0, 0); 206 | ``` 207 | 208 | #### Changing the TEMPERATURE of A Light 209 | 210 | To adjust the temperature, simply give the name or MAC and the name and then feed the temperature. *NOTE* Temperature must be an INT between 2000 and 9000. 211 | 212 | ```php 213 | $govee->lights()->setTemp("AC:14:A3:D5:E6:C4:3D:AE", 5000); 214 | 215 | or 216 | 217 | $govee->lights()->setTemp("Office-Wall", 5000); 218 | ``` 219 | 220 | #### Get the STATE of A Light 221 | 222 | To get all of the details about a light, simply feed getDeviceState the name or the MAC address. You'll get a JSON return you can then either read or feed to `json_decode` and turn in to an array to use/read. 223 | 224 | ```php 225 | $govee->lights()->getDeviceState("AC:14:A3:D5:E6:C4:3D:AE"); 226 | 227 | or 228 | 229 | $govee->lights()->getDeviceState("Office-Wall"); 230 | ``` 231 | 232 | ```json 233 | { 234 | "data": { 235 | "device": "AC:14:A3:D5:E6:C4:3D:AE", 236 | "model": "Office-Wall", 237 | "properties": [ 238 | { 239 | "online": true 240 | }, 241 | { 242 | "powerState": "on" 243 | }, 244 | { 245 | "brightness": 100 246 | }, 247 | { 248 | "color": { 249 | "r": 255, 250 | "b": 0, 251 | "g": 255 252 | } 253 | } 254 | ] 255 | } 256 | } 257 | ``` 258 | 259 | ## Plugs Functions 260 | 261 | ### Turn On A Plug 262 | 263 | ```php 264 | $govee->plugs()->turnOn("AC:14:A3:D5:E6:C4:3D:AE"); 265 | 266 | or 267 | 268 | $govee->plugs()->turnOn("Office-Wall"); 269 | ``` 270 | 271 | ### Turn Off A Plug 272 | 273 | ```php 274 | $govee->plugs()->turnOff("AC:14:A3:D5:E6:C4:3D:AE"); 275 | 276 | or 277 | 278 | $govee->plugs()->turnOff("Office-Wall"); 279 | ``` 280 | 281 | ## Contributing 282 | 283 | If you're having problems, spot a bug, or have a feature suggestion, [file an issue](https://github.com/dutchie027/govee-api/issues). If you want, feel free to fork the package and make a pull request. This is a work in progresss as I get more info and the Govee API grows. 284 | -------------------------------------------------------------------------------- /src/Connect.php: -------------------------------------------------------------------------------- 1 | p_token = $token; 132 | if (isset($attributes['log_dir']) && is_dir($attributes['log_dir'])) { 133 | $this->p_log_location = $attributes['log_dir']; 134 | } else { 135 | $this->p_log_location = sys_get_temp_dir(); 136 | } 137 | 138 | if (isset($attributes['log_name'])) { 139 | $this->p_log_name = $attributes['log_name']; 140 | if (!preg_match("/\.log$/", $this->p_log_name)) { 141 | $this->p_log_name .= ".log"; 142 | } 143 | } else { 144 | $this->p_log_name = $this->pGenRandomString() . "." . time() . ".log"; 145 | } 146 | if (isset($attributes['log_tag'])) { 147 | $this->p_log = new Logger($attributes['log_tag']); 148 | } else { 149 | $this->p_log = new Logger($this->p_log_tag); 150 | } 151 | 152 | if (isset($attributes['log_level']) && in_array($attributes['log_level'], $this->log_literals)) { 153 | if ($attributes['log_level'] == "debug") { 154 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::DEBUG)); 155 | } elseif ($attributes['log_level'] == "info") { 156 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::INFO)); 157 | } elseif ($attributes['log_level'] == "notice") { 158 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::NOTICE)); 159 | } elseif ($attributes['log_level'] == "warning") { 160 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::WARNING)); 161 | } elseif ($attributes['log_level'] == "error") { 162 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::ERROR)); 163 | } elseif ($attributes['log_level'] == "critical") { 164 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::CRITICAL)); 165 | } else { 166 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::WARNING)); 167 | } 168 | } else { 169 | $this->p_log->pushHandler(new StreamHandler($this->pGetLogPath(), Logger::INFO)); 170 | } 171 | $this->client = $client ?: new Guzzle(); 172 | } 173 | 174 | /** 175 | * getLogLocation 176 | * Alias to Get Log Path 177 | * 178 | * 179 | * @return string 180 | * 181 | */ 182 | public function getLogLocation() 183 | { 184 | return $this->pGetLogPath(); 185 | } 186 | 187 | /** 188 | * setRateVars 189 | * Takes a header array and sets the rate variables 190 | * 191 | * @param array $header 192 | * 193 | * @return void 194 | * 195 | */ 196 | public function setRateVars($header) 197 | { 198 | $this->rate_remain = $header['Rate-Limit-Remaining']; 199 | $this->rate_reset = $header['Rate-Limit-Reset']; 200 | $this->rate_total = $header['Rate-Limit-Total']; 201 | } 202 | 203 | /** 204 | * getDeviceList 205 | * Returns Full Device List Array 206 | * 207 | * 208 | * @return array 209 | * 210 | */ 211 | public function getDeviceList() 212 | { 213 | $url = self::API_URL . self::DEVICE_ENDPOINT; 214 | $response = $this->makeAPICall("GET", $url); 215 | $body_array = json_decode($response->getBody(), true); 216 | return $body_array['data']['devices']; 217 | } 218 | 219 | /** 220 | * getDeviceCount 221 | * Returns total number of controllable devices 222 | * 223 | * 224 | * @return int 225 | * 226 | */ 227 | public function getDeviceCount() 228 | { 229 | return count($this->getDeviceList()); 230 | } 231 | 232 | /** 233 | * getDeviceMACArray 234 | * Returns array of controllable MAC addresses 235 | * 236 | * 237 | * @return array 238 | * 239 | */ 240 | public function getDeviceMACArray() 241 | { 242 | $array = $this->getDeviceList(); 243 | foreach ($array as $devices) { 244 | $dev[] = $devices['device']; 245 | } 246 | return $dev; 247 | } 248 | 249 | /** 250 | * getDeviceNameArray 251 | * Returns Array of Device Names 252 | * 253 | * 254 | * @return array 255 | * 256 | */ 257 | public function getDeviceNameArray() 258 | { 259 | $array = $this->getDeviceList(); 260 | foreach ($array as $devices) { 261 | $dev[] = $devices['deviceName']; 262 | } 263 | return $dev; 264 | } 265 | 266 | /** 267 | * getAPIToken 268 | * Returns the stored API Token 269 | * 270 | * 271 | * @return string 272 | * 273 | */ 274 | protected function getAPIToken() 275 | { 276 | return $this->p_token; 277 | } 278 | 279 | /** 280 | * getLogPointer 281 | * Returns a referencd to the logger 282 | * 283 | * 284 | * @return reference 285 | * 286 | */ 287 | public function getLogPointer() 288 | { 289 | return $this->p_log; 290 | } 291 | 292 | /** 293 | * pGetLogPath 294 | * Returns full path and name of the log file 295 | * 296 | * 297 | * @return string 298 | * 299 | */ 300 | protected function pGetLogPath() 301 | { 302 | return $this->p_log_location . '/' . $this->p_log_name; 303 | } 304 | 305 | /** 306 | * setHeaders 307 | * Sets the headers using the API Token 308 | * 309 | * 310 | * @return array 311 | * 312 | */ 313 | public function setHeaders() 314 | { 315 | $array = [ 316 | 'User-Agent' => 'testing/1.0', 317 | 'Content-Type' => 'application/json', 318 | 'Govee-API-Key' => $this->getAPIToken() 319 | ]; 320 | return $array; 321 | } 322 | 323 | /** 324 | * pGenRandomString 325 | * Generates a random string of $length 326 | * 327 | * @param int $length 328 | * 329 | * @return string 330 | * 331 | */ 332 | private function pGenRandomString($length = 6) 333 | { 334 | $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 335 | $charactersLength = strlen($characters); 336 | $randomString = ''; 337 | for ($i = 0; $i < $length; $i++) { 338 | $randomString .= $characters[rand(0, $charactersLength - 1)]; 339 | } 340 | return $randomString; 341 | } 342 | 343 | 344 | public function makeAPICall($type, $url, $body = null) 345 | { 346 | $data['headers'] = $this->setHeaders(); 347 | $data['body'] = $body; 348 | if ($this->checkPing()) { 349 | try { 350 | $request = $this->client->request($type, $url, $data); 351 | } catch (RequestException $e) { 352 | if ($e->hasResponse()) { 353 | $response = $e->getResponse(); 354 | print $response->getBody(); 355 | exit; 356 | } 357 | } 358 | } 359 | $this->setRateVars($request->getHeaders()); 360 | return $request; 361 | } 362 | 363 | public function checkPing() 364 | { 365 | $url = self::API_URL . self::PING_ENDPOINT; 366 | $response = $this->client->request('GET', $url); 367 | if ($response->getStatusCode() == 200) { 368 | // in future we might want to regex match the word 369 | // pong (case insensitive) which is what their endpoint 370 | // currently returns. However, 200 is much safer than 371 | // looking for a specific word 372 | //if (preg_match("/pong/i", $response->getBody())) { 373 | return true; 374 | } else { 375 | die("API Seems Offline or you have connectivity issues at present."); 376 | } 377 | } 378 | 379 | public function lights() 380 | { 381 | $lights = new Lights($this); 382 | return $lights; 383 | } 384 | 385 | public function plugs() 386 | { 387 | $plugs = new Plugs($this); 388 | return $plugs; 389 | } 390 | } 391 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "fd29387891af7ab7f712624d413d100f", 8 | "packages": [ 9 | { 10 | "name": "guzzlehttp/guzzle", 11 | "version": "7.4.1", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/guzzle/guzzle.git", 15 | "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee0a041b1760e6a53d2a39c8c34115adc2af2c79", 20 | "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "ext-json": "*", 25 | "guzzlehttp/promises": "^1.5", 26 | "guzzlehttp/psr7": "^1.8.3 || ^2.1", 27 | "php": "^7.2.5 || ^8.0", 28 | "psr/http-client": "^1.0", 29 | "symfony/deprecation-contracts": "^2.2 || ^3.0" 30 | }, 31 | "provide": { 32 | "psr/http-client-implementation": "1.0" 33 | }, 34 | "require-dev": { 35 | "bamarni/composer-bin-plugin": "^1.4.1", 36 | "ext-curl": "*", 37 | "php-http/client-integration-tests": "^3.0", 38 | "phpunit/phpunit": "^8.5.5 || ^9.3.5", 39 | "psr/log": "^1.1 || ^2.0 || ^3.0" 40 | }, 41 | "suggest": { 42 | "ext-curl": "Required for CURL handler support", 43 | "ext-intl": "Required for Internationalized Domain Name (IDN) support", 44 | "psr/log": "Required for using the Log middleware" 45 | }, 46 | "type": "library", 47 | "extra": { 48 | "branch-alias": { 49 | "dev-master": "7.4-dev" 50 | } 51 | }, 52 | "autoload": { 53 | "psr-4": { 54 | "GuzzleHttp\\": "src/" 55 | }, 56 | "files": [ 57 | "src/functions_include.php" 58 | ] 59 | }, 60 | "notification-url": "https://packagist.org/downloads/", 61 | "license": [ 62 | "MIT" 63 | ], 64 | "authors": [ 65 | { 66 | "name": "Graham Campbell", 67 | "email": "hello@gjcampbell.co.uk", 68 | "homepage": "https://github.com/GrahamCampbell" 69 | }, 70 | { 71 | "name": "Michael Dowling", 72 | "email": "mtdowling@gmail.com", 73 | "homepage": "https://github.com/mtdowling" 74 | }, 75 | { 76 | "name": "Jeremy Lindblom", 77 | "email": "jeremeamia@gmail.com", 78 | "homepage": "https://github.com/jeremeamia" 79 | }, 80 | { 81 | "name": "George Mponos", 82 | "email": "gmponos@gmail.com", 83 | "homepage": "https://github.com/gmponos" 84 | }, 85 | { 86 | "name": "Tobias Nyholm", 87 | "email": "tobias.nyholm@gmail.com", 88 | "homepage": "https://github.com/Nyholm" 89 | }, 90 | { 91 | "name": "Márk Sági-Kazár", 92 | "email": "mark.sagikazar@gmail.com", 93 | "homepage": "https://github.com/sagikazarmark" 94 | }, 95 | { 96 | "name": "Tobias Schultze", 97 | "email": "webmaster@tubo-world.de", 98 | "homepage": "https://github.com/Tobion" 99 | } 100 | ], 101 | "description": "Guzzle is a PHP HTTP client library", 102 | "keywords": [ 103 | "client", 104 | "curl", 105 | "framework", 106 | "http", 107 | "http client", 108 | "psr-18", 109 | "psr-7", 110 | "rest", 111 | "web service" 112 | ], 113 | "support": { 114 | "issues": "https://github.com/guzzle/guzzle/issues", 115 | "source": "https://github.com/guzzle/guzzle/tree/7.4.1" 116 | }, 117 | "funding": [ 118 | { 119 | "url": "https://github.com/GrahamCampbell", 120 | "type": "github" 121 | }, 122 | { 123 | "url": "https://github.com/Nyholm", 124 | "type": "github" 125 | }, 126 | { 127 | "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", 128 | "type": "tidelift" 129 | } 130 | ], 131 | "time": "2021-12-06T18:43:05+00:00" 132 | }, 133 | { 134 | "name": "guzzlehttp/promises", 135 | "version": "1.5.1", 136 | "source": { 137 | "type": "git", 138 | "url": "https://github.com/guzzle/promises.git", 139 | "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" 140 | }, 141 | "dist": { 142 | "type": "zip", 143 | "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", 144 | "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", 145 | "shasum": "" 146 | }, 147 | "require": { 148 | "php": ">=5.5" 149 | }, 150 | "require-dev": { 151 | "symfony/phpunit-bridge": "^4.4 || ^5.1" 152 | }, 153 | "type": "library", 154 | "extra": { 155 | "branch-alias": { 156 | "dev-master": "1.5-dev" 157 | } 158 | }, 159 | "autoload": { 160 | "psr-4": { 161 | "GuzzleHttp\\Promise\\": "src/" 162 | }, 163 | "files": [ 164 | "src/functions_include.php" 165 | ] 166 | }, 167 | "notification-url": "https://packagist.org/downloads/", 168 | "license": [ 169 | "MIT" 170 | ], 171 | "authors": [ 172 | { 173 | "name": "Graham Campbell", 174 | "email": "hello@gjcampbell.co.uk", 175 | "homepage": "https://github.com/GrahamCampbell" 176 | }, 177 | { 178 | "name": "Michael Dowling", 179 | "email": "mtdowling@gmail.com", 180 | "homepage": "https://github.com/mtdowling" 181 | }, 182 | { 183 | "name": "Tobias Nyholm", 184 | "email": "tobias.nyholm@gmail.com", 185 | "homepage": "https://github.com/Nyholm" 186 | }, 187 | { 188 | "name": "Tobias Schultze", 189 | "email": "webmaster@tubo-world.de", 190 | "homepage": "https://github.com/Tobion" 191 | } 192 | ], 193 | "description": "Guzzle promises library", 194 | "keywords": [ 195 | "promise" 196 | ], 197 | "support": { 198 | "issues": "https://github.com/guzzle/promises/issues", 199 | "source": "https://github.com/guzzle/promises/tree/1.5.1" 200 | }, 201 | "funding": [ 202 | { 203 | "url": "https://github.com/GrahamCampbell", 204 | "type": "github" 205 | }, 206 | { 207 | "url": "https://github.com/Nyholm", 208 | "type": "github" 209 | }, 210 | { 211 | "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", 212 | "type": "tidelift" 213 | } 214 | ], 215 | "time": "2021-10-22T20:56:57+00:00" 216 | }, 217 | { 218 | "name": "guzzlehttp/psr7", 219 | "version": "2.1.0", 220 | "source": { 221 | "type": "git", 222 | "url": "https://github.com/guzzle/psr7.git", 223 | "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72" 224 | }, 225 | "dist": { 226 | "type": "zip", 227 | "url": "https://api.github.com/repos/guzzle/psr7/zipball/089edd38f5b8abba6cb01567c2a8aaa47cec4c72", 228 | "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72", 229 | "shasum": "" 230 | }, 231 | "require": { 232 | "php": "^7.2.5 || ^8.0", 233 | "psr/http-factory": "^1.0", 234 | "psr/http-message": "^1.0", 235 | "ralouphie/getallheaders": "^3.0" 236 | }, 237 | "provide": { 238 | "psr/http-factory-implementation": "1.0", 239 | "psr/http-message-implementation": "1.0" 240 | }, 241 | "require-dev": { 242 | "bamarni/composer-bin-plugin": "^1.4.1", 243 | "http-interop/http-factory-tests": "^0.9", 244 | "phpunit/phpunit": "^8.5.8 || ^9.3.10" 245 | }, 246 | "suggest": { 247 | "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" 248 | }, 249 | "type": "library", 250 | "extra": { 251 | "branch-alias": { 252 | "dev-master": "2.1-dev" 253 | } 254 | }, 255 | "autoload": { 256 | "psr-4": { 257 | "GuzzleHttp\\Psr7\\": "src/" 258 | } 259 | }, 260 | "notification-url": "https://packagist.org/downloads/", 261 | "license": [ 262 | "MIT" 263 | ], 264 | "authors": [ 265 | { 266 | "name": "Graham Campbell", 267 | "email": "hello@gjcampbell.co.uk", 268 | "homepage": "https://github.com/GrahamCampbell" 269 | }, 270 | { 271 | "name": "Michael Dowling", 272 | "email": "mtdowling@gmail.com", 273 | "homepage": "https://github.com/mtdowling" 274 | }, 275 | { 276 | "name": "George Mponos", 277 | "email": "gmponos@gmail.com", 278 | "homepage": "https://github.com/gmponos" 279 | }, 280 | { 281 | "name": "Tobias Nyholm", 282 | "email": "tobias.nyholm@gmail.com", 283 | "homepage": "https://github.com/Nyholm" 284 | }, 285 | { 286 | "name": "Márk Sági-Kazár", 287 | "email": "mark.sagikazar@gmail.com", 288 | "homepage": "https://github.com/sagikazarmark" 289 | }, 290 | { 291 | "name": "Tobias Schultze", 292 | "email": "webmaster@tubo-world.de", 293 | "homepage": "https://github.com/Tobion" 294 | }, 295 | { 296 | "name": "Márk Sági-Kazár", 297 | "email": "mark.sagikazar@gmail.com", 298 | "homepage": "https://sagikazarmark.hu" 299 | } 300 | ], 301 | "description": "PSR-7 message implementation that also provides common utility methods", 302 | "keywords": [ 303 | "http", 304 | "message", 305 | "psr-7", 306 | "request", 307 | "response", 308 | "stream", 309 | "uri", 310 | "url" 311 | ], 312 | "support": { 313 | "issues": "https://github.com/guzzle/psr7/issues", 314 | "source": "https://github.com/guzzle/psr7/tree/2.1.0" 315 | }, 316 | "funding": [ 317 | { 318 | "url": "https://github.com/GrahamCampbell", 319 | "type": "github" 320 | }, 321 | { 322 | "url": "https://github.com/Nyholm", 323 | "type": "github" 324 | }, 325 | { 326 | "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", 327 | "type": "tidelift" 328 | } 329 | ], 330 | "time": "2021-10-06T17:43:30+00:00" 331 | }, 332 | { 333 | "name": "monolog/monolog", 334 | "version": "2.3.5", 335 | "source": { 336 | "type": "git", 337 | "url": "https://github.com/Seldaek/monolog.git", 338 | "reference": "fd4380d6fc37626e2f799f29d91195040137eba9" 339 | }, 340 | "dist": { 341 | "type": "zip", 342 | "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9", 343 | "reference": "fd4380d6fc37626e2f799f29d91195040137eba9", 344 | "shasum": "" 345 | }, 346 | "require": { 347 | "php": ">=7.2", 348 | "psr/log": "^1.0.1 || ^2.0 || ^3.0" 349 | }, 350 | "provide": { 351 | "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" 352 | }, 353 | "require-dev": { 354 | "aws/aws-sdk-php": "^2.4.9 || ^3.0", 355 | "doctrine/couchdb": "~1.0@dev", 356 | "elasticsearch/elasticsearch": "^7", 357 | "graylog2/gelf-php": "^1.4.2", 358 | "mongodb/mongodb": "^1.8", 359 | "php-amqplib/php-amqplib": "~2.4 || ^3", 360 | "php-console/php-console": "^3.1.3", 361 | "phpspec/prophecy": "^1.6.1", 362 | "phpstan/phpstan": "^0.12.91", 363 | "phpunit/phpunit": "^8.5", 364 | "predis/predis": "^1.1", 365 | "rollbar/rollbar": "^1.3", 366 | "ruflin/elastica": ">=0.90@dev", 367 | "swiftmailer/swiftmailer": "^5.3|^6.0" 368 | }, 369 | "suggest": { 370 | "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", 371 | "doctrine/couchdb": "Allow sending log messages to a CouchDB server", 372 | "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", 373 | "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", 374 | "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", 375 | "ext-mbstring": "Allow to work properly with unicode symbols", 376 | "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", 377 | "ext-openssl": "Required to send log messages using SSL", 378 | "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", 379 | "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", 380 | "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", 381 | "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", 382 | "php-console/php-console": "Allow sending log messages to Google Chrome", 383 | "rollbar/rollbar": "Allow sending log messages to Rollbar", 384 | "ruflin/elastica": "Allow sending log messages to an Elastic Search server" 385 | }, 386 | "type": "library", 387 | "extra": { 388 | "branch-alias": { 389 | "dev-main": "2.x-dev" 390 | } 391 | }, 392 | "autoload": { 393 | "psr-4": { 394 | "Monolog\\": "src/Monolog" 395 | } 396 | }, 397 | "notification-url": "https://packagist.org/downloads/", 398 | "license": [ 399 | "MIT" 400 | ], 401 | "authors": [ 402 | { 403 | "name": "Jordi Boggiano", 404 | "email": "j.boggiano@seld.be", 405 | "homepage": "https://seld.be" 406 | } 407 | ], 408 | "description": "Sends your logs to files, sockets, inboxes, databases and various web services", 409 | "homepage": "https://github.com/Seldaek/monolog", 410 | "keywords": [ 411 | "log", 412 | "logging", 413 | "psr-3" 414 | ], 415 | "support": { 416 | "issues": "https://github.com/Seldaek/monolog/issues", 417 | "source": "https://github.com/Seldaek/monolog/tree/2.3.5" 418 | }, 419 | "funding": [ 420 | { 421 | "url": "https://github.com/Seldaek", 422 | "type": "github" 423 | }, 424 | { 425 | "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", 426 | "type": "tidelift" 427 | } 428 | ], 429 | "time": "2021-10-01T21:08:31+00:00" 430 | }, 431 | { 432 | "name": "psr/http-client", 433 | "version": "1.0.1", 434 | "source": { 435 | "type": "git", 436 | "url": "https://github.com/php-fig/http-client.git", 437 | "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" 438 | }, 439 | "dist": { 440 | "type": "zip", 441 | "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", 442 | "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", 443 | "shasum": "" 444 | }, 445 | "require": { 446 | "php": "^7.0 || ^8.0", 447 | "psr/http-message": "^1.0" 448 | }, 449 | "type": "library", 450 | "extra": { 451 | "branch-alias": { 452 | "dev-master": "1.0.x-dev" 453 | } 454 | }, 455 | "autoload": { 456 | "psr-4": { 457 | "Psr\\Http\\Client\\": "src/" 458 | } 459 | }, 460 | "notification-url": "https://packagist.org/downloads/", 461 | "license": [ 462 | "MIT" 463 | ], 464 | "authors": [ 465 | { 466 | "name": "PHP-FIG", 467 | "homepage": "http://www.php-fig.org/" 468 | } 469 | ], 470 | "description": "Common interface for HTTP clients", 471 | "homepage": "https://github.com/php-fig/http-client", 472 | "keywords": [ 473 | "http", 474 | "http-client", 475 | "psr", 476 | "psr-18" 477 | ], 478 | "support": { 479 | "source": "https://github.com/php-fig/http-client/tree/master" 480 | }, 481 | "time": "2020-06-29T06:28:15+00:00" 482 | }, 483 | { 484 | "name": "psr/http-factory", 485 | "version": "1.0.1", 486 | "source": { 487 | "type": "git", 488 | "url": "https://github.com/php-fig/http-factory.git", 489 | "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" 490 | }, 491 | "dist": { 492 | "type": "zip", 493 | "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", 494 | "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", 495 | "shasum": "" 496 | }, 497 | "require": { 498 | "php": ">=7.0.0", 499 | "psr/http-message": "^1.0" 500 | }, 501 | "type": "library", 502 | "extra": { 503 | "branch-alias": { 504 | "dev-master": "1.0.x-dev" 505 | } 506 | }, 507 | "autoload": { 508 | "psr-4": { 509 | "Psr\\Http\\Message\\": "src/" 510 | } 511 | }, 512 | "notification-url": "https://packagist.org/downloads/", 513 | "license": [ 514 | "MIT" 515 | ], 516 | "authors": [ 517 | { 518 | "name": "PHP-FIG", 519 | "homepage": "http://www.php-fig.org/" 520 | } 521 | ], 522 | "description": "Common interfaces for PSR-7 HTTP message factories", 523 | "keywords": [ 524 | "factory", 525 | "http", 526 | "message", 527 | "psr", 528 | "psr-17", 529 | "psr-7", 530 | "request", 531 | "response" 532 | ], 533 | "support": { 534 | "source": "https://github.com/php-fig/http-factory/tree/master" 535 | }, 536 | "time": "2019-04-30T12:38:16+00:00" 537 | }, 538 | { 539 | "name": "psr/http-message", 540 | "version": "1.0.1", 541 | "source": { 542 | "type": "git", 543 | "url": "https://github.com/php-fig/http-message.git", 544 | "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" 545 | }, 546 | "dist": { 547 | "type": "zip", 548 | "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", 549 | "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", 550 | "shasum": "" 551 | }, 552 | "require": { 553 | "php": ">=5.3.0" 554 | }, 555 | "type": "library", 556 | "extra": { 557 | "branch-alias": { 558 | "dev-master": "1.0.x-dev" 559 | } 560 | }, 561 | "autoload": { 562 | "psr-4": { 563 | "Psr\\Http\\Message\\": "src/" 564 | } 565 | }, 566 | "notification-url": "https://packagist.org/downloads/", 567 | "license": [ 568 | "MIT" 569 | ], 570 | "authors": [ 571 | { 572 | "name": "PHP-FIG", 573 | "homepage": "http://www.php-fig.org/" 574 | } 575 | ], 576 | "description": "Common interface for HTTP messages", 577 | "homepage": "https://github.com/php-fig/http-message", 578 | "keywords": [ 579 | "http", 580 | "http-message", 581 | "psr", 582 | "psr-7", 583 | "request", 584 | "response" 585 | ], 586 | "support": { 587 | "source": "https://github.com/php-fig/http-message/tree/master" 588 | }, 589 | "time": "2016-08-06T14:39:51+00:00" 590 | }, 591 | { 592 | "name": "psr/log", 593 | "version": "1.1.4", 594 | "source": { 595 | "type": "git", 596 | "url": "https://github.com/php-fig/log.git", 597 | "reference": "d49695b909c3b7628b6289db5479a1c204601f11" 598 | }, 599 | "dist": { 600 | "type": "zip", 601 | "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", 602 | "reference": "d49695b909c3b7628b6289db5479a1c204601f11", 603 | "shasum": "" 604 | }, 605 | "require": { 606 | "php": ">=5.3.0" 607 | }, 608 | "type": "library", 609 | "extra": { 610 | "branch-alias": { 611 | "dev-master": "1.1.x-dev" 612 | } 613 | }, 614 | "autoload": { 615 | "psr-4": { 616 | "Psr\\Log\\": "Psr/Log/" 617 | } 618 | }, 619 | "notification-url": "https://packagist.org/downloads/", 620 | "license": [ 621 | "MIT" 622 | ], 623 | "authors": [ 624 | { 625 | "name": "PHP-FIG", 626 | "homepage": "https://www.php-fig.org/" 627 | } 628 | ], 629 | "description": "Common interface for logging libraries", 630 | "homepage": "https://github.com/php-fig/log", 631 | "keywords": [ 632 | "log", 633 | "psr", 634 | "psr-3" 635 | ], 636 | "support": { 637 | "source": "https://github.com/php-fig/log/tree/1.1.4" 638 | }, 639 | "time": "2021-05-03T11:20:27+00:00" 640 | }, 641 | { 642 | "name": "ralouphie/getallheaders", 643 | "version": "3.0.3", 644 | "source": { 645 | "type": "git", 646 | "url": "https://github.com/ralouphie/getallheaders.git", 647 | "reference": "120b605dfeb996808c31b6477290a714d356e822" 648 | }, 649 | "dist": { 650 | "type": "zip", 651 | "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", 652 | "reference": "120b605dfeb996808c31b6477290a714d356e822", 653 | "shasum": "" 654 | }, 655 | "require": { 656 | "php": ">=5.6" 657 | }, 658 | "require-dev": { 659 | "php-coveralls/php-coveralls": "^2.1", 660 | "phpunit/phpunit": "^5 || ^6.5" 661 | }, 662 | "type": "library", 663 | "autoload": { 664 | "files": [ 665 | "src/getallheaders.php" 666 | ] 667 | }, 668 | "notification-url": "https://packagist.org/downloads/", 669 | "license": [ 670 | "MIT" 671 | ], 672 | "authors": [ 673 | { 674 | "name": "Ralph Khattar", 675 | "email": "ralph.khattar@gmail.com" 676 | } 677 | ], 678 | "description": "A polyfill for getallheaders.", 679 | "support": { 680 | "issues": "https://github.com/ralouphie/getallheaders/issues", 681 | "source": "https://github.com/ralouphie/getallheaders/tree/develop" 682 | }, 683 | "time": "2019-03-08T08:55:37+00:00" 684 | }, 685 | { 686 | "name": "symfony/deprecation-contracts", 687 | "version": "v2.5.0", 688 | "source": { 689 | "type": "git", 690 | "url": "https://github.com/symfony/deprecation-contracts.git", 691 | "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" 692 | }, 693 | "dist": { 694 | "type": "zip", 695 | "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", 696 | "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", 697 | "shasum": "" 698 | }, 699 | "require": { 700 | "php": ">=7.1" 701 | }, 702 | "type": "library", 703 | "extra": { 704 | "branch-alias": { 705 | "dev-main": "2.5-dev" 706 | }, 707 | "thanks": { 708 | "name": "symfony/contracts", 709 | "url": "https://github.com/symfony/contracts" 710 | } 711 | }, 712 | "autoload": { 713 | "files": [ 714 | "function.php" 715 | ] 716 | }, 717 | "notification-url": "https://packagist.org/downloads/", 718 | "license": [ 719 | "MIT" 720 | ], 721 | "authors": [ 722 | { 723 | "name": "Nicolas Grekas", 724 | "email": "p@tchwork.com" 725 | }, 726 | { 727 | "name": "Symfony Community", 728 | "homepage": "https://symfony.com/contributors" 729 | } 730 | ], 731 | "description": "A generic function and convention to trigger deprecation notices", 732 | "homepage": "https://symfony.com", 733 | "support": { 734 | "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" 735 | }, 736 | "funding": [ 737 | { 738 | "url": "https://symfony.com/sponsor", 739 | "type": "custom" 740 | }, 741 | { 742 | "url": "https://github.com/fabpot", 743 | "type": "github" 744 | }, 745 | { 746 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 747 | "type": "tidelift" 748 | } 749 | ], 750 | "time": "2021-07-12T14:48:14+00:00" 751 | } 752 | ], 753 | "packages-dev": [], 754 | "aliases": [], 755 | "minimum-stability": "stable", 756 | "stability-flags": [], 757 | "prefer-stable": false, 758 | "prefer-lowest": false, 759 | "platform": [], 760 | "platform-dev": [], 761 | "plugin-api-version": "2.1.0" 762 | } 763 | --------------------------------------------------------------------------------