PHP code example of imjoehaines / flowder

1. Go to this page and download the library: Download imjoehaines/flowder 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/ */

    

imjoehaines / flowder example snippets


$db = new PDO('sqlite::memory:');

$flowder = new Imjoehaines\Flowder\Flowder(
    new Imjoehaines\Flowder\Loader\PhpFileLoader(),
    new Imjoehaines\Flowder\Truncator\SqliteTruncator($db),
    new Imjoehaines\Flowder\Persister\SqlitePersister($db)
);

$flowder->loadFixtures('test_data.php');

return [
    [
        'column1' => 1,
        'column2' => 2,
    ],
    [
        'column1' => 4,
        'column2' => 5,
    ],
];

[
    'example_table' => [
        [
            'column1' => 1,
            'column2' => 2,
        ],
        [
            'column1' => 4,
            'column2' => 5,
        ],
    ],
]

$loader = new DirectoryLoader(
    new PhpFileLoader()
);

$data = $loader->load('/some/directory');

$loader = new CachingLoader(
    new DirectoryLoader(
        new PhpFileLoader()
    )
);

for ($i = 0; $i < 100; $i++) {
    $data = $loader->load('/some/directory');
}