buildok / file_transmitter
File Transmitter
dev-master / 1.0.x-dev
2016-09-12 18:06 UTC
Requires
- php: ~5.6|~7.0
This package is not auto-updated.
Last update: 2025-01-18 22:09:31 UTC
README
This composer-package allows you to receive pictures from a remote host and save the file system.
Example implementation with applying SOLID.
Install
Via Composer
$ composer require buildok/file_transmitter
Usage
require_once "vendor/autoload.php"; use buildok\file_transmitter\base\exceptions\FileTransmitterException; use buildok\file_transmitter\base\HttpTransmitter; use buildok\file_transmitter\base\FileValidator; use buildok\file_transmitter\PictureTransmitter; $pt = new PictureTransmitter(new HttpTransmitter, new FileValidator); try { if($pt->transmit('https://avatars2.githubusercontent.com/u/6459721?v=3&s=460', '/var/www/html')) { echo 'transmit OK'; } else { print_r($pt->getErrors()); } } catch(FileTransmitterException $e) { echo $e->getMessage(); }