DuckThom / laravel-importer by DuckThom

Extensible importer for Laravel
90
8
3
Package Data
Maintainer Username: DuckThom
Maintainer Contact: thomas.wiringa@gmail.com (Thomas Wiringa)
Package Create Date: 2017-02-18
Package Last Update: 2017-10-05
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2025-02-09 15:16:52
Package Statistics
Total Downloads: 90
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 8
Total Watchers: 3
Total Forks: 1
Total Open Issues: 0

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.