1. Go to this page and download the library: Download devian2011/seeder 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/ */
devian2011 / seeder example snippets
$seeder = new \Devian2011\Seeder\Seeder(
['/path/to/notations/one', '/path/to/notations/two'], // Required param
['/path/to/env/file/.env', '/path/to/env/file/.env.local'] // optional param, it can be empty
);
$seeder->run(
new \Devian2011\Seeder\Output\SymfonyConsoleOutput($output), // Output wrapper
new class implements \Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface {
public function getFunctions(){
return [
new \Symfony\Component\ExpressionLanguage\ExpressionFunction('plus', fn() -> return;, fn($ctx, $a , $b) -> return $a + $b)
]
}
}, // Expression Language extensions
[
new class implements \Devian2011\Seeder\Events\EventHandlerInterface {
public function getActions() : array
{
return [\Devian2011\Seeder\SeederEvents::EVENT_SEEDER_CONFIG_LOADED]
// List of events You cann see all events in \Devian2011\Seeder\SeederEvents
}
public function handle(\Devian2011\Seeder\Events\EventInterface $event){
echo $event->getMessage(); // Event handler
}
}
] // Array of event handlers
);