function replace($file_id, $file) { $endpoint = "https://api.hubapi.com/filemanager/api/v2/files/{$file_id}"; $options['body'] = ['files' => fopen($file, 'rb')]; return $this->client->request('post', $endpoint, $options); }