Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Content Faker Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

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.

Gotchas and Tips

  • Faker seeding is process-wide. 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.
  • Seeded output changed in v1.2.0. Decoration positions now respect the seed. If you have snapshots generated with v1.1.0 and a seed, expect them to change after upgrading.
  • Locales do not change generated prose. The prose comes from Faker’s Lorem provider, which no locale overrides. A locale-specific generator still produces Latin placeholder text.
  • Custom prose requires a 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.
  • Custom randomness can break reproducibility. If your own provider uses random_int() or other non-seeded randomness, output will not be reproducible. Prefer Faker’s APIs for random selection.
  • Provider registration order matters. Add custom providers to the generator before passing it to make(), markdown_faker(), or withFaker().
  • Pin the version for fixture-heavy projects. If snapshots depend on seeded decoration placement, use a ^1.2 constraint and regenerate fixtures deliberately when upgrading.
  • Debugging non-deterministic output: confirm the seed is set immediately before generation, check for extra Faker calls, and audit custom providers for unseeded randomness.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings