Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Laravel 5 Essentials

You're reading from   Laravel 5 Essentials Explore the fundamentals of Laravel, one of the most expressive and robust PHP frameworks available

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781785283017
Length 144 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Martin Bean Martin Bean
Author Profile Icon Martin Bean
Martin Bean
Arrow right icon
View More author details
Toc

Dealing with files

Laravel 5 includes the excellent Flysystem project for interacting with files both in the application filesystem, as well as popular cloud-based storage solutions such as Amazon Simple Storage Service (Amazon S3) and Rackspace. Filesystems are configured as disks in the config/filesystems.php file. You can then use a consistent API to manage files, whether they are located locally or in an external cloud store.

Calling methods directly on the Storage façade will call those methods on the default disk as follows:

Storage::exists('foo.txt');

You can also explicitly specify the disk to perform actions on, in case you have more than one disk configured, as follows:

Storage::disk('local')->exists('foo.txt');

You can read and write data to files as follows:

Storage::put('foo.txt', $contents);
$contents = Storage::get('foo.txt');

You can also prepend or append data instead as follows:

Storage::prepend('foo.txt', &apos...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image