Files
mtdb_movie/common/Files/FileDownloader.php
maher 703f50a09d
Some checks failed
Build / run (push) Has been cancelled
first commit
2025-10-29 11:42:25 +01:00

56 lines
1.1 KiB
PHP
Executable File

<?php namespace Common\Files;
use GuzzleHttp\Client;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Filesystem\FilesystemManager;
class FileDownloader {
/**
* Upload model.
*
* @var FileEntry
*/
private $upload;
/**
* Http client instance.
*
* @var Client
*/
private $http;
/**
* Laravel Storage service instance.
*
* @var FilesystemAdapter
*/
private $laravelStorage;
/**
* Storage constructor.
*
* @param FileEntry $upload
* @param Client $http
* @param FilesystemManager $laravelStorage
*/
public function __construct(FileEntry $upload, Client $http, FilesystemManager $laravelStorage)
{
$this->upload = $upload;
$this->http = $http;
$this->laravelStorage = $laravelStorage;
}
/**
* Download file from specified remote url.
*
* @param string $url
* @param array $params
*
* @return string
*/
public function downloadRemoteFile($url, $params = [])
{
return $this->http->request('GET', $url, $params)->getBody()->getContents();
}
}