Laravel Load File is a package to help with loading files into MySQL tables. This uses MySQL's LOAD DATA statement to load text files quickly into your database.

This library currently can handle any of the options in a normal LOAD DATA statement except for the partitioned table support.

LoadFile::file('/path/to/employees.csv', $local = true) ->into('employees') ->columns(['forename', 'surname', 'employee_id']) // like this ->fieldsTerminatedBy(',') ->fieldsEscapedBy('\\\\') ->fieldsEnclosedBy('"') // or ->fields(',', '\\\\', '"') ->load(); Loading data into Eloquent Models

Then you can use the following method to load a file into that table: User::loadFile('/path/to/users.csv', $local = true); Need to specify options to load the file with?
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners