gotipath / storage
Gotipath Storage is a file storage library for PHP. It provides one interface to interact with FTP/SFTP. When you use this package, you're protected from vendor lock-in, That mean you can connect to any FTP/SFTP storage. Also it's comes with base URL option to connect Gotipath CDN.
Fund package maintenance!
gotipath
Requires
- php: ^7.3
- league/flysystem: ^2.3
- league/flysystem-sftp: ^2.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.3
- vimeo/psalm: ^4.8
README
Gotipath Storage is a file storage library for PHP. It provides one interface to interact with FTP/SFTP. When you use this package, you're protected from vendor lock-in, That mean you can connect to any FTP/SFTP storage. Also it's comes with base URL option to connect Gotipath CDN.
This package can be used as a framework-agnostic package. Follow these steps to get started:
Installation
You can install the package via composer:
composer require gotipath/storage
Usage
require_once __DIR__ . '/vendor/autoload.php'; $storage = new Storage('sftp', [ 'host' => 'ftp.fas.xyx.com', 'username' => 'sftp/ftp username', 'password' => 'sftp/ftp password', //if you connecting ssh // 'privateKey' => '/path/to/privateKey', // 'password' => 'encryption-password', 'port' => 22, 'root' => '/pub', 'timeout' => 30, ],$baseUrl='https://cdn.gotipath.com');
create directory
$path = 'uploads/testdir'; $config = []; // optional $storage->makeDirectory($path, $config);
get file
$storage->get($path);
multipart/formdata upload
$inputFile = $_FILES['file']; $path = 'uploads/'.$inputFile['name']; $temp = $_FILES["file"]["tmp_name"]; $storage->upload($path,$temp);
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.