Laravel File vs Storage facade

alex picture alex · Mar 6, 2016 · Viewed 8.6k times · Source

Is there any differences between File and Storage facades in laravel 5.2 ?
it seems they both use the same contract.i see no documentation for File in laravel documentation. if they are different how may interact with each other?

Answer

Christoffer Tyrefors picture Christoffer Tyrefors · Mar 6, 2016

File is a quite simple wrapper for PHP functions such as file_exists() etc. Storage is "a powerful filesystem abstraction thanks to the wonderful Flysystem PHP package by Frank de Jonge". This can be used to act on local files (i.e Storage::disk('local')->exists('path')).

Prior to Laravel 5, Laravel had no Flysystem integration. At that time, the File facade was "the way" to interact with (local files). I would guess that the documentation for File is removed in order to make users use the Storage instead. The Filesystem does work though.