Download the PHP package sascha-steinbrink/laravel-csv-file-seeder without Composer

On this page you can find all versions of the php package sascha-steinbrink/laravel-csv-file-seeder. 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-csv-file-seeder

LaravelCsvFileSeeder

Latest Version on Packagist Total Downloads Build Status codecov StyleCI

This package provides the ability to import or export your database to csv or zip files.

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

This package can be used in Laravel 5.5 or higher!

Via Composer

If you want to use zipped files make sure and is installed on your system!

You can publish the configuration file with the following command:

The configuration file contains:

Usage

You can seed or export your database through the console using the following artisan commands:

To seed your database using laravel's command you have to register the in the class.

The main difference between those two methods is the flexibility of changing the default values of the configuration file through command options which is only possible with the command.

Without any options given or by using the command all available commands will use the values from the config/laravel-csv-file-seeder.php configuration file.

The default data path in the config file points to database/data. Therefore a call to or would seed all files from the database/data directory with an .csv extension into the database.

The csv file names must match the corresponding table names! All csv files where the name does not match any table in the database will be ignored.

You can debug the output of the commands to see which files were ignored (and other information) by increasing the verbosity level (-v/-vv/-vvv)!

If you are getting 'Integrity constraint violation' errors while seeding try to disable the foreign key checks either by specifying the / option or by disable them globally in the config/laravel-csv-file-seeder.php configuration file

The export command will export all tables (except the ones specified in the config file which are by default migrations and password_resets) into database/data directory.

To be able to change any of the configuration values you have to publish the configuration file. See the installation instructions to do so.

Available seed options

Note: This options can only be assigned to the command! To change any option for the command you have to change the values in the configuration file!

Option Default Description
--data-path -p database/data The folder the csv files are located in
--files -i [] The files that should be seeded
--delimiter -d ',' The delimiter character to use for parsing csv fields
--enclosure -l '"' The enclosure character to use for parsing csv fields
--escape -c '\' The escape character to use for parsing csv fields
--trim-values -m true Should trim lead-/trailing white spaces from csv fields
--insert-chunk-size -s 50 The number of rows to read before an insert query is fired
--truncate -t true Truncate the desired tables before seeding
--foreign-key-checks -k true Enable/disable foreign key checks while truncating
--zipped -z false Import data is an archive (zip) file
--archive-name -a "db-csv-export.zip" The archive name to import
--encrypted -e false The import archive is encrypted
--connection default The database connection to seed
--force Force the operation to run when in production

The defaults to the default database connection ()

Available export options

Option Default Description
--data-path -p database/data The folder the csv files should be stored
--except -x "migrations,password_resets" The tables that should be ignored
--with-headers -w true Should include column names
--delimiter -d ',' The delimiter character to use for parsing csv fields
--enclosure -l '"' The enclosure character to use for parsing csv fields
--escape -c '\' The escape character to use for parsing csv fields
--export-chunk-size -s 100 The number of items to be written into the csv file at a time
--zipped -z false Export data as an archive (zip) file
--archive-name -a "db-csv-export.zip" The archive name to use for saving
--encrypted -e false Encrypt the archive
--connection default The database connection to export

The defaults to the default database connection ()

Using a different path

To seed all csv files located in /my/path:

To export all tables (except the ones specified in the config file) as csv files into /my/path:

Using a different delimiter

To seed all csv files located in /my/path using a semicolon as delimiter:

To export all tables (except the ones specified in the config file) as csv files into /my/path using a semicolon as delimiter:

Using an archive file

The zip option is not available on windows!

To seed the export.zip archive located in /my/path:

To export all tables (except the ones specified in the config file) into database/data/dbExport.zip:

Only specific files

To import only the users.csv file located in database/data:

To import only the users.csv file located in /my/other/path:

To export all tables except the users table and the migrations table to the database/data directory:

Using an encrypted archive

The zip option is not available on windows!

When providing the or option in combination with the or option a password prompt will be shown, where you can specify the password to use for encryption.

The or will be ignored when zipping is not activated. (Either by setting the option / or by enabling the zipped option in the configuration file.)

To seed the encrypted db-csv-export.zip archive located in /my/path:

To export all tables into an encrypted /my/path/encrypted.zip archive:

NOTE:

If you want to specify a default encryption password for your project you can add it to your env file using the key.

Using a connection other than the default

To seed all csv files located in /my/path using the database bound to my-other-db connection:

To export all tables as csv files into /my/path using the database bound to my-other-db connection:

The is set to also include the excepted ones specified in the config file which are by default migrations and password_resets

FAQ

Please see the FAQ for more information.

Change log

Please see the changelog for more information on what has changed recently.

Testing

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.


All versions of laravel-csv-file-seeder with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ~6
laravel/helpers Version ~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 sascha-steinbrink/laravel-csv-file-seeder contains the following files

Loading the files please wait ....