定制 ekoukltd/s3-import-export 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ekoukltd/s3-import-export

最新稳定版本:1.0.4

Composer 安装命令:

composer require ekoukltd/s3-import-export

包简介

Easy import & export of Laravel models (tables) to local or S3 Storage as a JSON file. For when you don't want to restore a whole backup, just a few tables.

README 文档

README

Latest Version on Packagist Total Downloads

Ever needed to copy selected models between server environments? Or seed a database with latest content?

This package exports models to S3 or other remote disks as a JSON file.

This is not designed to be a robust backup service

Just a tool to move content based models between different environments without any hassle.

Installation

Install the package via composer:

composer require ekoukltd/s3-import-export

Configuration

Publish the config file to config/s3-import-export.php

php artisan vendor:publish --provider="Ekoukltd\S3ImportExport\S3IOServiceProvider" --tag="config"

and define which what should be exported to where. For S3 you need to have setup league/filesystem see: https://laravel.com/docs/9.x/filesystem#s3-driver-configuration

    //Data will be exported to this disk -> choose from config.filesystems.disks options
	//Note that if using s3 a local copy will also be created in storage when importing
	//When running tests local storage copy will be used.
	'disk'           => 's3',
	
	//Where to stick em.  Note trailing slash
	'export_dir' => 'content-export/',
	
	//Add your models to import and export here
	'content_models' => [
		//Json object exports are ideal for copying content type data like pages, posts and templates 
		//without affecting the reset of the database
		'App\\Models\\Pages',
		'App\\Models\\Posts',
		'App\\Models\\EmailTemplates',
	],
	 
	 /** IMPORTANT **/
	//Carbon dates export with a timezone by default, which throws an error when importing to sql
	//If your using timestamps either set any other date fields here 
	'date_columns' => ['created_at', 'updated_at', 'deleted_at']
    
    //or set the format in the model
    protected $casts = [
        'email_verified_at' => 'datetime:Y-m-d H:i:s'
        'my_date_field'     => 'datetime:Y-m-d H:i:s',
    ];

Usage

#Export from the CLI
php artisan data:export

#Import
php artisan data:import

#Or in a scheduled task:
Artisan::call('data:export');

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email support@ekouk.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 31
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固