luna / laravel-importer
Laravel的可扩展导入器
1.0.2
2017-10-05 20:58 UTC
Requires
- php: >=7.0
- illuminate/database: 5.4.* | 5.5.*
- illuminate/filesystem: 5.4.* | 5.5.*
- illuminate/support: 5.4.* | 5.5.*
- nesbot/carbon: ^1.22
Requires (Dev)
- phpunit/phpunit: ^6.0
This package is auto-updated.
Last update: 2024-09-18 21:50:37 UTC
README
# 先决条件
在开始使用此包之前,请确保您至少运行了PHP 7.0,并且安装了Laravel 5.4。
# 配置
首先,将此包添加到您的 composer.json
composer require luna/laravel-importer "~1.0"
将服务提供者和外观添加到 config/app.php
'providers' => [ // ... // Package providers Luna\Importer\ServiceProvider::class, ], 'aliases' => [ // ... "Import" => Luna\Importer\ImporterFacade::class ]
发布配置
php artisan vendor:publish --provider="Luna\Importer\ServiceProvider"
# 功能
此插件目前仅包含CSV运行器,这意味着它只能开箱即用地解析CSV文件。稍后会有更多关于如何添加运行器的信息。
# 文档
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 ] ];
# 贡献
欢迎提交包含相关测试的新特性拉取请求。