# laravel-mysql-to-seeder **Repository Path**: fzls/laravel-mysql-to-seeder ## Basic Information - **Project Name**: laravel-mysql-to-seeder - **Description**: MySQL to Laravel >5.1 Seeder - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-02 - **Last Updated**: 2024-05-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MySQL to Laravel Seeder [![Packagist](https://img.shields.io/packagist/v/schwarzer/laravel-mysql-to-seeder.svg)](https://packagist.org/packages/schwarzer/laravel-mysql-to-seeder) [![Packagist](https://img.shields.io/packagist/l/schwarzer/laravel-mysql-to-seeder.svg)](https://packagist.org/packages/schwarzer/laravel-mysql-to-seeder) [![Packagist](https://img.shields.io/packagist/dt/schwarzer/laravel-mysql-to-seeder.svg)](https://packagist.org/packages/schwarzer/laravel-mysql-to-seeder) I was in need of a tool to export Data from an existing MySQL DB to a Laravel Seeder. I searched online for it, but found not the right tool I wanted. I stumbled upon the [namelivia/mysql-to-laravel-seed](https://github.com/namelivia/mysql-to-laravel-seed). But it ... - ... used outdated functions - ... forced me to create a export schema - ... didn't create working Seeders (missing `use Illuminate\Database\Seeder;`) - and the Seeders didn't look nice I decided to create my own version of a MySQL to Laravel Seeder Tool. #### works with | PHP Version | MySQL Version | |-------------|---------------| | 5.6.17 | 5.6.25 | | 5.6.17 | 5.7.10 | | 7.0.2 | 5.6.25 | | 7.0.2 | 5.7.10 | I welcome all notifications about working environments. Just mail me (*info@schwarzer.it*) and I'll put it up here, or send a merge request. ## Simple Examples Create a file named export.php in your Laravel root (*where your `.env` is*) and execute it by using `php ./export.php` . Done. ### Use without Composer autoload ```php generateExport( null, // null equals "All Tables" ( $this->getAllTableNames() ) './database/seeds', // if null './database/seeds' is applied ['these','are','boolean','values'], ['timestamp_column','created_at', 'updated_at'], ['type','date'] ); ``` ### Use with Composer autoload ```php generateExport( null, // null equals "All Tables" ( $this->getAllTableNames() ) './database/seeds', // if null './database/seeds' is applied ['these','are','boolean','values'], ['timestamp_column','created_at', 'updated_at'], ['type','date'] ); ```