luna/laravel-importer

Extensible importer for Laravel
90 8
Install
composer require luna/laravel-importer
Latest Version:1.0.2
PHP:>=7.0
License:MIT
Last Updated:Oct 5, 2017
Links: GitHub  ·  Packagist
Maintainer: DuckThom

Before using this package, make sure you are at least running PHP 7.0 and that you have Laravel 5.4.

First, add this package to your composer.json:

    composer require luna/laravel-importer "~1.0"

Add the service provider and facade to config/app.php:

    'providers' => [
        // ...
        // Package providers

        Luna\Importer\ServiceProvider::class,
    ],

    'aliases' => [
        // ...

        "Import" => Luna\Importer\ImporterFacade::class
    ]

Publish the configuration:

    php artisan vendor:publish --provider="Luna\Importer\ServiceProvider"

This plugin currently only comes with a CSV runner which means it is only able to parse CSV files out of the box. There will be more info on how to add runners added later.

http://laravel-importer.readthedocs.io/en/latest/

config/importer.php:

return [
    /***********************************************************
     * Importers are used for defining specific import tasks
     * For instance, a ProductImporter could import a file with
     * products into a table.
     ***********************************************************/
    'importers' => [
        'default' => \App\Importers\ProductImporter::class
    ],

    /***********************************************************
     * Runners are used for looping through the file
     * The default is a CSV runner which will loop though
     * CSV files line-by-line. A runner uses an importer to get
     * import specific settings like the model class.
     ***********************************************************/
    'runners' => [
        'default' => \Luna\Importer\Runners\CsvRunner::class
    ]
];

Pull requests for new features are welcome as long as they include tests for it as well.

Related Packages

erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

628,058,007 9,707
laravel/framework

The Laravel Framework.

576,155,700 34,907
laravel/tinker

Powerful REPL for the Laravel framework.

485,678,092 7,440