Download the PHP package isaacdew/load-data without Composer

On this page you can find all versions of the php package isaacdew/load-data. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package load-data

Introduction

MySQL and MariaDB come equipped with the LOAD DATA INFILE statement which allows for loading large datasets from a CSV or similar file into a table very quickly. This package provides an API for constructing and executing a LOAD DATA INFILE statement in Laravel.

Installation

Install this package using composer:

composer require isaacdew/load-data

Examples

Basic Example

Ignoring the CSV Header

Defining Columns

Using the Headers from the CSV to Define Your Columns

By default, the CSV headers are converted to snake case since the columns need to match your database table column names. If you need to do any custom modification, you can pass a callback to the useFileHeaderForColumns method.

Only Loading Specific Columns from the CSV

Truncating the Table Before Load

Using Set Statements

To use this feature, you must define the columns first either with the columns method or by using the file header with the useFileHeaderForColumns method. Then you can modify the value from your CSV using a MySQL expression. A good use case is a date column where the CSV isn't using a MySQL friendly format. Note that you must prefix the column name with @ to use it in your expression.

Dedicated Database Servers

If your Laravel application is not on the same server as your database, you will have to make sure the LOAD DATA LOCAL INFILE statement is enabled on your database server and in PDO. This package will automatically use the LOCAL keyword if your DB_HOST is not set to 127.0.0.1 or localhost.

To enable LOAD DATA LOCAL INFILE in PDO, go to your config/database.php file and add PDO::MYSQL_ATTR_LOCAL_INFILE => true to the array of options for the mysql connection like so:

Note On Security

Prepared statements are not supported for LOAD DATA INFILE statements. With that being the case, do not use user input for constructing a LOAD DATA INFILE statement. I took the precaution of using PDO::quote() to escape the filename, however, I would still recommend against the use of a user provided filename in this statement.


All versions of load-data with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package isaacdew/load-data contains the following files

Loading the files please wait ....