Skip to content

Simple library showing how to use an inverse generator to act as a batch importer

License

Notifications You must be signed in to change notification settings

azPHP/important

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

important

Simple library showing how to use an inverse generator to act as a batch importer

Configuration

composer require azphp/important

Usage

<?php

$batcher = function (array $values)
{
    /** @var \PDO $myDb */
    $stmt = $myDb->query('INSERT blah blah');
    // maybe do some data transformation
    $stmt->execute($values);
};

$importer = \AzPHP\Important\Importer::createImporter(
    $batcher,
    100
);

/** @var iterable $someData */
foreach ($someData as $value) {
    $importer->send($value);
}

// finish any extra values not covered by a batch
$importer->send(null);

About

Simple library showing how to use an inverse generator to act as a batch importer

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages