Flysystems is used for the abstracted filesystem in XenForo 2, but I was just thinking... it's not particularly complicated. Maybe it would be worthwhile thinking about getting rid of that third-party library and just use standard PHP streams instead? Internally could just use stream_wrapper_register() to register a XenForo filesystem of sorts and then just use normal PHP functions. Similar to how
Why not just have wrappers and the abstracted filesystem is just handled by that wrapper?
Wouldn't be terribly difficult, and you just do the same thing internally that you are already doing with the Flysystems implementation. Call the appropriate class for the individual functions (for example "Local").
Anyway, just a thought for something relatively simple that gets rid of a fairly substantial dependency and probably would be faster anyway since you don't need to initialize the Flysytems stack.
https is a stream wrapper for URLs within normal functions:
PHP:
file_get_contents('https://example.com');
Why not just have wrappers and the abstracted filesystem is just handled by that wrapper?
PHP:
file_get_contents('internal-data://attachments/10/10747-5c6c6dc97fc6298686c67d0d703a9fd4.data');
file_put_contents('data://avatars/h/0/1.jpg', $contents);
Wouldn't be terribly difficult, and you just do the same thing internally that you are already doing with the Flysystems implementation. Call the appropriate class for the individual functions (for example "Local").
Anyway, just a thought for something relatively simple that gets rid of a fairly substantial dependency and probably would be faster anyway since you don't need to initialize the Flysytems stack.
Upvote
8