awcodes/content-faker
Content Faker is a Laravel package for generating realistic fake content with Faker. Quickly populate forms and models, seed demos, and preview layouts without manual data entry, streamlining development and testing workflows.
Install the package with Composer (composer require awcodes/content-faker), then use the markdown_faker() helper or MarkdownFaker::make() to generate fake Markdown content.
First use case: generate realistic Markdown for docs pages, demo articles, seed data, or snapshot tests.
$markdown = markdown_faker()->docsPage()->render();
echo $markdown;
Start by checking the package README/source for the available content generators (docsPage(), article(), etc.) and whether they accept options. render() returns a Markdown string, so you can write it to a file, return it from a test fixture, or pass it to your Markdown renderer.
v1.2.0 is additive: existing helper and make() calls continue to work. The main new capabilities are reproducible seeded output and injecting your own Faker\Generator.
Basic generation
markdown_faker()->article()->render();
markdown_faker()->docsPage()->render();
Seeded, reproducible output
Seed immediately before generating the content you want to reproduce:
fake()->seed(1234);
$markdown = markdown_faker()->docsPage()->render();
// Identical on every run, including inline decoration placement.
This is the pattern to use for snapshot tests, fixture files, visual regression tests, and demo data where diffs should be meaningful.
Bring your own Faker generator
Pass a generator through the helper, make(), or the fluent withFaker() method:
$faker = fake();
$faker->addProvider(new class($faker) extends \Faker\Provider\Lorem {
protected static $wordList = ['alpha', 'bravo', 'charlie'];
});
MarkdownFaker::make($faker)->article()->render();
markdown_faker($faker)->article()->render();
MarkdownFaker::make()->withFaker($faker)->article()->render();
Use this when you need domain-specific vocabulary, custom providers, or a shared Faker instance already configured by your application/test suite.
Testing and fixtures
it('renders a reproducible docs page', function () {
fake()->seed(1234);
expect(markdown_faker()->docsPage()->render())
->toMatchSnapshot();
});
For multiple artefacts, seed before each one. Do not seed once and assume each subsequent generation is independently reproducible; Faker’s state advances as content is generated.
Application/demo data
Generate Markdown in a seeder or Artisan command and write it to storage:
Storage::put(
'demo/docs/getting-started.md',
markdown_faker()->docsPage()->render()
);
This is useful for local demos, documentation previews, and populating a CMS with realistic long-form content.
fake()->seed() affects all Faker instances in the process. Seed immediately before the content you want to reproduce, and avoid unrelated Faker calls between seeding and generation.Lorem provider, which no locale overrides. A locale-specific generator still produces Latin placeholder text.Lorem provider. Extend Faker\Provider\Lorem and set your own $wordList. Overriding individual methods such as paragraph() is not enough because Lorem calls its own methods internally.random_int() or other non-seeded randomness, output will not be reproducible. Prefer Faker’s APIs for random selection.make(), markdown_faker(), or withFaker().^1.2 constraint and regenerate fixtures deliberately when upgrading.How can I help you explore Laravel packages today?