Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greeflas/php-image-downloader
[TEST TASK]: Simple library for image downloading with validation support
https://github.com/greeflas/php-image-downloader
curl php php-library test-task
Last synced: about 1 month ago
JSON representation
[TEST TASK]: Simple library for image downloading with validation support
- Host: GitHub
- URL: https://github.com/greeflas/php-image-downloader
- Owner: greeflas
- Created: 2017-02-09T15:24:58.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-17T14:23:10.000Z (about 6 years ago)
- Last Synced: 2024-04-25T16:03:20.074Z (7 months ago)
- Topics: curl, php, php-library, test-task
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Component for downloading images by URL
======================================This is component for downloading images by URL from another servers.
This component uses [cURL](http://php.net/manual/en/book.curl.php) PHP library.[![Total Downloads](https://poser.pugx.org/greeflas/php-image-downloader/downloads)](https://packagist.org/packages/greeflas/php-image-downloader)
[![Latest Stable Version](https://poser.pugx.org/greeflas/php-image-downloader/v/stable)](https://packagist.org/packages/greeflas/php-image-downloader)
[![Latest Unstable Version](https://poser.pugx.org/greeflas/php-image-downloader/v/unstable)](https://packagist.org/packages/greeflas/php-image-downloader)
[![License](https://poser.pugx.org/greeflas/php-image-downloader/license)](https://packagist.org/packages/greeflas/php-image-downloader)Installation
------------
The preferred way to install the component is through [composer](https://getcomposer.org/download/).Either run
```
composer require greeflas/php-image-downloader
```
or add
```json
"greeflas/php-image-downloader": "dev-master"
```
to the require section of your composer.json.Using
-----
Create component instance
```php
$downloader = new \greeflas\tools\ImageDownloader([
'class' => \greeflas\tools\validators\ImageValidator::class
]);
```
in array you should specify the validator class. It used for validation of downloaded files.
If you don't want run validation, you can use a `\greeflas\tools\validators\FakeValidator::class`.Then you should call method for downloading
```php
$downloader->download($url, $imagesRoot, $fileName);
```
this method takes as agruments: URL to image, path to catalog where file will be saved and name for downloaded file.