1. Go to this page and download the library: Download dknx01/data-fixtures 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/ */
dknx01 / data-fixtures example snippets
new Configuration(pdo: $pdo, databaseName: 'foo');
new Configuration(dsn: 'mysql:host=localhost;port=3307;dbname=testdb', user: 'foo', password: 'bar', options: []);
/// your code
$this->loadFixtures();
$this->executeFixtures($configuration);
/// your code
// your code
$fixtures = new FixtureCollection();
$fixtures->add(new SimpleFixture());
$handler = new FixtureHandler($configuration);
$handler->handle($fixtures);
// your code
#[DataFixture(UserFixture::class)]
#[DataFixture(new BlaFixture(
name: 'Test123',
fileName: 'Test123'
))]
public function testFoo(): void
{
// cor code
}
#[DependFixture(BarFixture::class)]
class FooFixture implements FixtureInterface, FakerAware
{
// your code
}