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

1.0 2021-11-03 07:35 UTC

This package is auto-updated.

Last update: 2024-10-29 06:36:24 UTC


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.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.