Download the PHP package mtcmedia/laravel-import without Composer

On this page you can find all versions of the php package mtcmedia/laravel-import. 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 laravel-import

Laravel Import

This package allows you to do data import into Laravel application. This package uses json format source-maps where you define mapping between source data and expected database structure.

Running a command

Package uses artisan commands to run the import commands for their respective source conversion drivers.

These commands will load source-map file from storage path and will attempt at processing passed data to given data.

Installation

This package is compatible with Laravel 5.5 or higher. You can install the package via composer using the following command:

Whilst Laravel 5.4 or below is not officially supported the functionality should work if the service provider is registered. This can be done by just adding the service provider in config/app.php file:

Usage

Import functionality is called by artisan commands for the respective driver.

Defining Importable Models

To allow data import on a model you will need to add Mtc\Import\Traits\Importable trait to your Eloquent models.

This will provide the additional methods to the models for importing.

To see what fields are allowed to be imported the package will look for $importable attribute on Model. This attribute should define the columns that can be populated. If the $importable field is not defined on the model it will fall back to using $fillable as basis for importable columns. If model does not use $fillable attribute it will use the last resort of connecting to database and allowing all columns.

It is also possible to define the fallback values on the model columns to ensure the correct data type is set for the attributes using $importable_defaults attribute on model

As for importing related models the package will expect $importable_relationships attribute to be present. If this attribute will not be set it will not allow importing the relationships even if they are part of the source map. Importable relationships should follow the below example.

Defining Source Map

Source file must be defined before doing import and should follow the outlined example:

The source map is split into 3 top level objects:

Supported methods / built-in logic

Since data rarely transfers from one structure to a different one in one-to-one fashion there are some methods that are built in to help with the data migration.

Looping

Large requirement for importing data usually is processing normalized data with children entries. Rather than creating a separate import map and processing for these child entries this package allows processing looped data (e.g. item with multiple images).

By default package uses * symbol to identify looped item, however this can be changed in the import config. When using looped structure the relation will go through all possible entries and create child entries for them. NB This functionality supports only data-fetching from same structure, it will not allow loading data from two different data loops

Context Functions

The import engine uses context functions that are simply identified by using tilde symbol before its name and wrapping attributes in parenthesis resulting in the following format: ~function().
Currently following context functions are supported:

Extendability

Main options for extending the functionality is during the mapping process. This can be done by mapping field against the ~external() method that allows calling methods for parsing data values.

Configuration

This package offers 2 config files (database.php and import.php).

database.php extends the main database config by adding a new connection for import source. This source is used for database import flow.

import.php offers configuration options for the package like changing the import file paths in storage directory, defining db chunk sizes or changing the loop operator symbol.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

The GNU General Purpose License (GPL). Please see License File for more information.


All versions of laravel-import with dependencies

PHP Build Version
Package Version
Requires league/csv Version ^9.1
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 mtcmedia/laravel-import contains the following files

Loading the files please wait ....