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

Component: Virtual Filesystem #38

Closed
JoshuaEstes opened this issue Oct 23, 2023 · 0 comments · Fixed by #51
Closed

Component: Virtual Filesystem #38

JoshuaEstes opened this issue Oct 23, 2023 · 0 comments · Fixed by #51

Comments

@JoshuaEstes
Copy link
Member

JoshuaEstes commented Oct 23, 2023

Need component that can be used to access different filesystem types. Native, S3, InMemory, etc.

Could streams be used for this? Could use vfs:// and would provide access to whatever was registered.

// Create a new filesystem that uses the existing filesystem. The root directory is `/tmp`
$filesystem = new Filesystem(new NativeAdapter('/tmp'));
$filesystem->touch('test.txt'); // Would be the same as `touch /tmp/text.txt`

Filesystem API

  • write
  • read
  • delete / rm
  • touch
  • mkdir
  • move / mv
  • copy / cp
  • stat
  • chmod
  • chown

The adapter API may have a lot more methods as part of its interface. The filesystem interface is more end user friendly with fewer methods.

Think I can use mount/unmount methods to provide the stream wrapper.

Stream::mount('vfs', $adapter);

Doing something like that you can do all kinds of fun things and register s3:// for the S3 adapter

Requirements

  • Must provide an Interface that end users can use to interact with different filesystems
  • Must provide a Native or Local adapter to manage files locally
  • Must provide a Memory adapter that would be used for testing
  • Must be able to move/copy a file from one filesystem to another (Might be able to be done via some type of manager that can mount/unmount different filesystems)
@JoshuaEstes JoshuaEstes linked a pull request Oct 25, 2023 that will close this issue
3 tasks
@JoshuaEstes JoshuaEstes added this to the v1.x milestone Nov 14, 2023
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

Successfully merging a pull request may close this issue.

1 participant