Rodrigo Calix Rodrigo Calix - 1 year ago 140
JSON Question

How to create a text file and a JSON with laravel 4 framework?

Hello!, the question might be simple, but i couldn't find the answer.

i want to create a .txt file with laravel 4 and upload it to my server like PHP does, and also
i need to create a JSON file with laravel 4 and upload it to my server.

Thanks for your help!

Answer Source

To use the filesystem of Laravel, you should access it through the File Facade.

Create a new file:

File::put('web/text/mytextdocument.txt','John Doe');

Delete a file:

File::delete(string|array $paths)

The complete documentation on all available methods is found here: