- How do I install davidbadura/faker-markdown-generator in a Laravel project?
- Install it as a dev dependency with composer require --dev davidbadura/faker-markdown-generator, since it is a test and seeding tool rather than a runtime library. Then register the package's provider on your Faker instance using $faker->addProvider(...), which is Faker's standard extension point. In Laravel you would typically do this inside a seeder, a factory class, or a small test helper. There is no service provider or config file to publish.
- Does this package work with Laravel 10, Laravel 11, PHP 8.2 and PHP 8.3?
- The package is not bound to a Laravel version because it only extends Faker and never touches framework internals, so Laravel compatibility follows from Faker compatibility. The real gate is the composer.json constraints: the last release before 1.1.1 was October 2021, and the 1.1.1 notes mention only a bug fix with no updated PHP or Faker version constraints. Run composer require --dev on your actual matrix and confirm it resolves without --ignore-platform-reqs before committing to it.
- Is this a Laravel package with a service provider, or just a Faker provider?
- It is a plain Faker provider that extends Faker\Provider\Base and adds formatter methods that emit Markdown fragments. There is no service provider, no facade, no config surface, and no publishable assets. That makes it architecturally inert in production and usable in standalone PHP projects as well as Laravel, but it also means you wire it up yourself.
- How do I use it to seed blog posts or CMS content with random Markdown bodies?
- Register the provider and then call its Markdown formatter from your model factory definition, assigning the result to a body or content attribute. Because it returns a complete document covering headings, paragraphs, lists, links, and code, you get believable documentation-style text instead of a single blob of lorem ipsum. Note that the exact formatter method names are not documented in the overview, so check the provider source before writing factories. Keep the generation inside seeders or dev-only code paths.
- Is the generated Markdown actually valid for CommonMark or GitHub Flavored Markdown?
- The package claims structurally valid Markdown, but it does not state a target dialect (CommonMark, GFM, or a specific renderer) and ships no conformance test suite. The 1.1.1 release is itself a fix to the blockquote output it emits, a defect that sat open for years, which shows the bug class is not exhausted by one patch. Parse a sample of generated output with the exact renderer you care about, such as league/commonmark or a client-side GFM parser, before relying on it in rendering tests.
- Is the output reproducible with $faker->seed() for snapshot tests?
- Faker's seed() makes output deterministic only if the provider draws all randomness from Faker's seeded generator. Nothing in the package documentation or release notes confirms this, and any internal use of mt_rand or array_rand would produce flaky snapshots. Run a short spike: seed the generator, generate the same document twice, and diff the results. If it is stable, pin the seed in your test suite; if not, keep assertions structural rather than exact-match.
- Can it generate malformed Markdown for XSS and parser-hardening tests?
- Not reliably. The provider is built for realistic documentation-style content, not adversarial input, and there are no documented options for raw HTML blocks, javascript: links, unterminated fenced code, or deliberately broken nesting. For parser-hardening and sanitization tests you will still need hand-written fixtures, which reduces this package to half its value for that use case. Pair it with a curated adversarial fixture file.
- Can I control the generated length, heading depth, or mix of elements?
- The overview presents it as a single call that produces headings, paragraphs, lists, links, and code, and does not document parameterization for depth, block count, or element mix. Read the formatter signatures in the provider source, which is small, to see what arguments are actually accepted before assuming you can tune output. If the controls are absent, trim, concatenate, or fork the provider for your needs.
- Is the package actively maintained, and is it safe to depend on?
- It is dormant rather than dead: 1.1.1 ends a multi-year gap but contains only a blockquote bug fix, with no CI matrix, no stated PHP 8.2+ support, and no release cadence to extrapolate from. It has zero dependents and around eighteen stars, so there is little community validation of output correctness or constraint stability. Because it is a dev-only fixture generator with no production blast radius, the risk is manageable if you accept that you may need to fork it. Pin the version and keep a fork ready.
- What are the alternatives to this package for generating fake Markdown content?
- Alternatives are Faker's built-in text and paragraph formatters assembled by hand, a small custom Faker provider of your own, or static fixture files checked into the repo. If you only need one or two constructs, a custom provider is a few dozen lines and gives you full control over dialect and determinism. This package's advantage is covering headings, lists, links, and code in one call with almost no setup, and since it is small and has no credible incumbent, vendoring or forking is a realistic option rather than a last resort.