2017 © Pedro PelĂĄez
 

library flysystem-sftp-symlink-plugin

Sftp symlink plugin for Flysystem.

image

falc/flysystem-sftp-symlink-plugin

Sftp symlink plugin for Flysystem.

  • Sunday, December 13, 2015
  • by Falc
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,051 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

Flysystem Sftp Symlink Plugin

Requirements

Installation

Using composer:, (*1)

composer require falc/flysystem-sftp-symlink-plugin

Or add it manually:, (*2)

{
    "require": {
        "falc/flysystem-sftp-symlink-plugin": "1.*"
    }
}

Usage

This plugin requires a Filesystem instance using the Sftp adapter., (*3)

use Falc\Flysystem\Plugin\Symlink\Sftp as SftpSymlinkPlugin;
use League\Flysystem\Adapter\Sftp as SftpAdapter;
use League\Flysystem\Filesystem;

$filesystem = new Filesystem(new SftpAdapter(array(
    'host' => 'example.com',
    'port' => 22,
    'username' => 'username',
    'password' => 'password',
    'privateKey' => 'path/to/or/contents/of/privatekey',
    'root' => '/',
    'timeout' => 10
)));

Use symlink($target, $symlink) to create a symlink., (*4)

$filesystem->addPlugin(new SftpSymlinkPlugin\Symlink());

$success = $filesystem->symlink('/tmp/some/target', '/tmp/symlink');

Use deleteSymlink($symlink) to delete a symlink., (*5)

$filesystem->addPlugin(new SftpSymlinkPlugin\DeleteSymlink());

$success = $filesystem->deleteSymlink('/tmp/symlink');

Use isSymlink($filename) to check if a file exists and is a symlink., (*6)

$filesystem->addPlugin(new SftpSymlinkPlugin\IsSymlink());

$isSymlink = $filesystem->isSymlink('/tmp/symlink');

Full and relative paths

The above examples show how to create symlinks using / as root and full paths. But it is possible to use relative paths too., (*7)

use Falc\Flysystem\Plugin\Symlink\Sftp as SftpSymlinkPlugin;
use League\Flysystem\Adapter\Sftp as SftpAdapter;
use League\Flysystem\Filesystem;

$filesystem = new Filesystem(new SftpAdapter(array(
    'host' => 'example.com',
    'port' => 22,
    'username' => 'username',
    'password' => 'password',
    'privateKey' => 'path/to/or/contents/of/privatekey',
    'root' => '/home/falc',
    'timeout' => 10
)));

$filesystem->addPlugin(new SftpSymlinkPlugin\Symlink());
$filesystem->addPlugin(new SftpSymlinkPlugin\IsSymlink());
$filesystem->addPlugin(new SftpSymlinkPlugin\DeleteSymlink());

// Result: /home/falc/flytest -> /home/falc/projects/cli/flytest
$filesystem->symlink('projects/cli/flytest', 'flytest');

// It is possible to check it or delete it in the same way:
$isSymlink = $filesystem->isSymlink('flytest');
$filesystem->deleteSymlink('flytest');

The Versions

13/12 2015

dev-master

9999999-dev

Sftp symlink plugin for Flysystem.

  Sources   Download

MIT

The Requires

 

plugin sftp flysystem symlink

13/12 2015

v1.2.0

1.2.0.0

Sftp symlink plugin for Flysystem.

  Sources   Download

MIT

The Requires

 

plugin sftp flysystem symlink

11/03 2015

v1.1.0

1.1.0.0

Sftp symlink plugin for Flysystem.

  Sources   Download

MIT

The Requires

 

plugin sftp flysystem symlink

27/01 2015

v1.0.0

1.0.0.0

Sftp symlink plugin for Flysystem.

  Sources   Download

MIT

The Requires

 

plugin sftp flysystem symlink