PHP code example of lulco / populator

1. Go to this page and download the library: Download lulco/populator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lulco / populator example snippets


// file bin/command.php

$database = new Populator\Database\Database('db_name', 'mysql:dbname=db_name;host=db_host', 'db_user', 'db_password');
$populator = new Populator\Command\AutomaticPopulatorCommand($database, ['phoenix_log', 'phinxlog', 'migration_log', 'versions', 'api_logs', 'api_tokens'], true, $columnNameAndTypeCallbacks);

$application = new Application();
$application->add($populator);
$application->run();

// file bin/command.php

$application = new Symfony\Component\Console\Application();
$populator = new Populator\Command\PopulatorCommand();
$populator->addDatabase(new Populator\Database\Database('db_name', 'mysql:dbname=db_name;host=db_host', 'db_user', 'db_password'));

$table1Populator = new Populator\Populator\AutomaticPopulator('table_1', 50);
$populator->addPopulator($table1Populator);

$application->add($populator);
$application->run();

php bin/command.php populator:populate

php bin/command.php populator:populate