flywheel
flywheel copied to clipboard
Abstract filesystem access
We should use something like https://github.com/KnpLabs/Gaufrette to abstract away file system access to make testing easier. It could also allow people to use remote filesystems like S3 (if they are totally crazy).
Expanding on this, we need everything that touches the file system pulled out of Repository as there's far too much going on in that single class right now. I've just added the NestedRespository class and it's got even more complex.
While on the point of refactoring the Repository class, maybe its worth adding an interface for the repository. For example, storing on an S3 bucket may require extra some extra checks/setup and what not. An potential use case we have currently is the generation of live(ish) seat maps in SVG format. Currently they are generated periodically and stored on S3 (to avoid load balancing issues). Being able to access, and update them, may prove to be useful.
Just an example, of course.
It's funny, because I first thought of flysystem when I stumbled across this nifty library :)
Flysystem is a file system abstraction library from The PHP League -> http://flysystem.thephpleague.com/
It would fit the name of the library more. :)
Both Gaufrette and Flysystem has millions of installations and thousands of Github stars, but Flysystem has double the amount of both compared to Gaufrette. However, personally I would choose the one that I like the best, regardless. Both are stable and widely used.
Anyway, just thought I'd throw the idea out - because it would be cool to let Flywheel depend on Flysystem :+1:
I've put PR which replaces usage of glob() with FilesystemIterator this enables any valid StreamWrapper to support directory scanning. This may allow usage of any other filesystem libraries which have StreamWrapper support.