PHP code example of proner / storage

1. Go to this page and download the library: Download proner/storage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

proner / storage example snippets



use Proner\Storage\Storage;
$storage = new Storage('ftp');
$storage->setHost('172.20.15.999');
$storage->setLogin('usuario','senha');

$storage->setWorkdirLocal('arquivos');
$storage->setWorkdirRemote('arquivos');

//conectar e habilitar o cache
$storage->cacheConnect('172.20.15.990', 6379);


$file = 'pasta/teste.txt'; //Arquivo que vai ser baixado
$path = 'pasta'; //Diretorio a onde o arquivo será salvo locamente

$storage->get($file, $path);

//OU COM MÉTODO ESTATICO

Storage::get($file, $path);


$file = 'pasta/teste.txt'; //Arquivo que está procurando

$storage->getContent($file);

//OU COM MÉTODO ESTATICO

Storage::getContent($file);


$file = 'pasta/teste.txt'; //Arquivo que vai ser enviado
$path = 'pasta'; //Diretorio a onde o arquivo será salvo locamente

$storage->put($file, $path);

//OU COM MÉTODO ESTATICO

Storage::put($file, $path);


$file = 'pasta/teste.txt'; //Arquivo que vai ser enviado
$content = 'pasta'; //Conteúdo do novo arquivo

$storage->putContent($file, $content);

//OU COM MÉTODO ESTATICO

Storage::putContent($file, $content);


$file = 'teste.txt'; //Arquivo que está procurando
$path = 'pasta'; //Diretorio que está procurando o arquivo

$storage->fileExists($file, $path);

//OU COM MÉTODO ESTATICO

Storage::fileExists($file, $path);


$file = 'teste.jpg'; //Imagem

$storage->getImage($file); // data:image/jpg;base64, /9j/4AA.....

//OU COM MÉTODO ESTATICO

Storage::getImage($file); // data:image/jpg;base64, /9j/4AA.....