Download the PHP package jotagp/insert-multiple without Composer

On this page you can find all versions of the php package jotagp/insert-multiple. 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 insert-multiple

INSERT-MULTIPLE

Sumary

  1. Introduction
    1.1 What is
    1.2 Why
    1.3 Licence
  2. Get Started
    2.1 Dependences
    2.2 Instalation
    2.3 Usage
    2.4 Methods
    2.5 Exemple
  3. Enjoy

1. Introduction

1.1 What is
This is a simple PHP package to insert and update multiple data into a MySQL/MariaDB database.

1.2 Why
This package was created with the aim of reducing data insertion time. To understand the magnitude of the problem, let's assume that we want to go through the items in a list and insert them into a database.

The example above works. However, when working with a large volume of data, traditional insertion is not a viable option. This is because it inserts a single record at a time. So, if you have 100,000 records, there will be 100,000 insertions and, consequently, 100,000 trips to the hard disk to persist this data, and this task will take a long time (of course, it depends on the size of your data). One "option" is to control the transaction from the database manually, something like:

However, this approach still does not definitively solve our problem, as the time gain is not significant. What to do then? Simple! make a multiple insert:

However (there's always a however, right?), there is a transaction limit allowed by the bank, and this limit is easily reached when a very extensive query is set up. And that, my friends, is where this package comes in. It will partition your values ​​into N Multiple slots, according to your bank's capacity:

And it's that simple.

1.3 License
This code is licensed under the MIT license.

2. Get Start

2.1 Dependences
The library depends only on:

2.2 Instalation
Run the following command:

2.3 Usage
Include the dependences in your PHP project:

2.4 Methods
There are three possible methods:

push($associative_array)
This method works to include new values ​​in the insert. Note that the expected argument is an associative array, where the index of this array must always refer to the attribute of the table in question. Attributes that you do not specify will be included with their respective default values.

exec()
This method partitions your insert into N multiple inserts, then run, always taking into account the amount allowed in a transaction by your database instance (max_allowed_package) . That is, in an insert of 100 thousand records, hypothetically speaking the function will create 10 multiple inserts, each with 10 thousand records.

config($associative_array)
This method allows you to edit some behavior of the object. Possible configurations (so far) are:

2.5 Example
Inserting 100 thousand random data into database. Consider the following data structure:

Then:

3. Enjoy

Thanks for making it this far. I hope that this package will help you to have more performance in your day.
I remain at your disposal if you need assistance or have any suggestions. You can contact me on Linkedin.


All versions of insert-multiple 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 jotagp/insert-multiple contains the following files

Loading the files please wait ...