Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Filesystem, FTP with FlySystem in order to support more filesystems #8

Open
oparoz opened this issue Aug 12, 2015 · 6 comments

Comments

@oparoz
Copy link

oparoz commented Aug 12, 2015

"FlySystem is a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one. Reducing technical debt and chance of vendor lock-in."

It could replace the custom FileSystem and FTP modules and offer support for many more filesystems. Here is a list of what's available today :

  • Local
  • Azure
  • AWS S3 V2
  • AWS S3 V3
  • Copy.com
  • Dropbox
  • FTP / SFTP
  • GridFS
  • Memory
  • Rackspace
  • WebDAV
  • PHPCR
  • ZipArchive

The API

http://flysystem.thephpleague.com/api/

Write Files

$filesystem->write('path/to/file.txt', 'contents');

Update Files

$filesystem->update('path/to/file.txt', 'new contents');

Write or Update Files

$filesystem->put('path/to/file.txt', 'contents');

Read Files

$contents = $filesystem->read('path/to/file.txt');

Check if a file exists

$exists = $filesystem->has('path/to/file.txt');

Delete Files

$filesystem->delete('path/to/file.txt');

Read and Delete

$contents = $filesystem->readAndDelete('path/to/file.txt');

Rename Files

$filesystem->rename('filename.txt', 'newname.txt');

Copy Files

$filesystem->copy('filename.txt', 'duplicate.txt');

Get Mimetypes

$mimetype = $filesystem->getMimetype('path/to/file.txt');

Get Timestamps

$timestamp = $filesystem->getTimestamp('path/to/file.txt');

Get File Sizes

$size = $filesystem->getSize('path/to/file.txt');

Create Directories

$filesystem->createDir('path/to/nested/directory');

Directories are also made implicitly when writing to a deeper path

$filesystem->write('path/to/file.txt', 'contents');

Delete Directories

$filesystem->deleteDir('path/to/directory');

@oparoz oparoz changed the title Replace Filesystem, FTP with FlySystem Replace Filesystem, FTP with FlySystem in order to support more filesystems Aug 12, 2015
@DavertMik
Copy link
Member

Good idea. If you can get this module implemented that would be really cool!

@pavelsavelyev
Copy link

Hi, guys! We developed our version of the module and share it https://github.com/lamoda/codeception-flysystem currently supports 2 protocols (FTP, WebDAV), we already using it in our tests and will be happy if it will be useful for you. Comments/issues are welcome too :)

@SamMousa
Copy link

@pavelsavelyev it looks like something we could take inspiration from!

It doesn't have any tests though...

@pavelsavelyev
Copy link

@SamMousa Thank you for your feedback :) We will add tests in the nearest future, already created an issue based on your advice lamoda/codeception-flysystem#1

@DavertMik
Copy link
Member

Thanks, @pavelsavelyev
Wow, just watched video from Badoo Meetup where this module was presented by your colleague.
Looks awesome, I added it to our addons page https://codeception.com/addons

Probably we could have some chapter on filesystem testing in our documentation but I can't figure out where to put it. Maybe in Data testing? Maybe not )

@pavelsavelyev
Copy link

pavelsavelyev commented Apr 1, 2019

Oh, great news, really happy to see the module on Add-ons page, thank you @DavertMik :)
In the nearest future, we extend supported formats by S3 (this sprint). And after that probably we will share a couple more modules.
About where to put documentation, currently best options seems page Data, but not sure - everything is data :) and this page may become too big in perspective.

@Naktibalda Naktibalda transferred this issue from Codeception/Codeception Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants