From Gaufrette to Flysystem and back again
legacy 1 minutes and 41 secondsWhen I saw Gaufrette added a Flysystem adapter (a year ago to this day!) it somewhat captured my imagination and it seemed only right that Flysystem should have a Gaufrette adapter and the two file-system abstraction layers could work completely bi-directional.
It was mostly a bit of fun, although I could potentially see a use case even if that use case hadn’t crept up on me yet. Until now!
I recently worked on a legacy project which made use of Gaufrette and we were taking my favourite approach to tackling legacy. We were working completely on new code and writing adapters to old stuff which handled a lot of the existing heavy lifting. So, in the case of file-system abstraction we were writing an adapter to the old Gaufrette stuff, but due to a few reasons we were also keen on trying to make use of Flysystem. Then I remembered, this silly little library I had created!
“You mean we could work with Flysystem whilst not having to rewrite all of these touch points with Gaufrette”
We were using Symfony, so actually used this bundle to hook up Flysystem but essentially it just worked like this:
Pretty neat!
Obviously, having two file-system abstraction layers is a bit pointless, so eventually it would be nice to completely move away from Gaufrette, but as a nice compromise to ease over the transition this came in really handy.
So if you’re in a similar boat and want to transition from Gaufrette to Flysystem give my silly little library a try.
Finally, I’m not advocating that Flysystem is better than Gaufrette or anything, just that our needs for this particular project meant Flysystem was a better fit. They are equally as good as one another and I’m sure in some scenarios Gaufrette might have the edge. Indeed, if you wish to transition in the other direction you can always use the Gaufrette Flysystem adapter :).
blog comments powered by Disqus