PHP code example of holyshared / file-fixture

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

    

holyshared / file-fixture example snippets


$loaders = new LoaderContainer([
    new TextLoader()
]);

$fixtures = new FixtureContainer([
    'text:default:readme' => __DIR__ . '/README.md'
]);

$fixture = new FileFixture($fixtures, $loaders);
$content = $fixture->load('text:default:readme');

print $content;

$loaders = new LoaderContainer([
    new ArtLoader(new MustacheLoader(new TextLoader()))
]);

$fixtures = new FixtureContainer([
    'art:default:header' => __DIR__ . '/art.txt'
]);

$fixture = new FileFixture($fixtures, $loaders);
$content = $fixture->load('art:default:header');

print $content;

$textLoader = new TextLoader();
$loaders = new LoaderContainer([
    $textLoader,
    new MustacheLoader($textLoader)
]);

$factory = new FixtureContainerFactory();
$fixtures = $factory->createFromFile(__DIR__ . '/fixtures.toml');

$fixture = new FileFixture($fixtures, $loaders);
$content = $fixture->load('mustache:default:successMessage', [
    'name' => 'build'
]);

print $content;
text
<green>#######</green>
<green>#</green>
<green>#</green>
<green>#####</green>
<green>#</green>
<green>#</green>
<green>#</green>