bz4work / file-loader
Loading files from url.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires (Dev)
- php: >=5.4.0
- codeception/codeception: *
- yiisoft/yii2: ~2.0.14
- yiisoft/yii2-debug: ~2.0.0
- yiisoft/yii2-faker: ~2.0.0
- yiisoft/yii2-gii: ~2.0.0
This package is auto-updated.
Last update: 2024-10-11 14:47:08 UTC
README
Loading files from url.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist bz4work/file-loader "*"
or add
"bz4work/file-loader": "*"
to the require section of your composer.json
file.
Configure config.ini file.
Usage
In your controller:
//Create component container: $loader = Yii::$container->get('FileLoaderComponent'); $url = 'http://www.vsedela.info/gallery/201409151019eng0000003.jpeg'; $path = $loader->loadAndSave($url); //Pass value into the view: return $this->render('index', [ 'path' => $path ]);
In your view file:
<img src="<?php echo $path; ?>" alt="some alt">
Run tests with coverage:
./vendor/bin/codecept run unit --coverage-html
Run tests without coverage:
./vendor/bin/codecept run unit