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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners