Skip to content

BackEndTea/Phinx-CSV-Seeder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phinx Csv Seeder

Build Status

Instalation

$ composer require backendtea/phinx-csv-seeder

Requirements

  • PHP 5.6 or higher
  • robmorgan/phinx version 0.8.1 or higher

Usage

Basic usage:

<?php

use BackEndTea\MigrationHelper\CsvSeeder;

class UserSeeder extends CsvSeeder
{

    public function run()
    {
        $this->insertCsv('users', __DIR__ . '/users.csv');
    }
}

Will try and insert all csv records into the given table. The keys in the csv file are required to match the keys in the database. Any values for a row not specified become their defaults.