- How do I install aerni/factory in a Laravel project?
- Install it as a dev dependency with composer require --dev aerni/factory. It expects a Laravel application running Statamic, plus PHP 8.x and Faker, and ships no service provider that must run in production. After installing, you author one factory class per collection or blueprint and invoke it from a seeder or artisan command.
- Does aerni/factory support Statamic 5 and Laravel 11?
- The addon tracks Statamic majors, so check its Composer constraints against the exact Statamic and Laravel versions you run before committing. Pin the package version explicitly and run a factory regression in CI whenever you upgrade Statamic. Field-type coverage, especially Bard, Replicator and Grid, is the most likely breakage point across majors.
- Which Statamic field types can aerni/factory generate, like Bard, Replicator, Grid and assets?
- Coverage depends on the addon's implementation, and the least stable Statamic APIs, such as Bard, Replicator, Grid, assets, links and entry relations, are the most likely gaps. Validate against a representative blueprint in a short spike before standardizing. If a field type is unsupported, fall back to a hand-rolled Faker seeder using Statamic's entry API.
- How is aerni/factory different from Laravel model factories?
- Laravel factories target Eloquent models, while aerni/factory ports the same declarative pattern to Statamic collections and entries. A factory class describes field values and the addon produces fake entries through Faker. The output is ordinary Statamic content, so existing artisan commands, tests and CI read it without changes.
- Can aerni/factory generate multisite or localized entries?
- Multisite support is something to verify for your own setup, because localized entries and site-specific field values add complexity beyond a single-site collection. Test it with a small factory on a localized collection before relying on it. If locales are not handled cleanly, generating per-site entries manually in a seeder is a small amount of code.
- Is aerni/factory safe to use in production?
- Usage is dev and test only, so the realistic worst case is seeding breaking after an upgrade rather than a production incident. The addon sits in the content-authoring layer and adds no routes, middleware or front-end runtime services. Keep it in require-dev and do not depend on it for production content.
- How do I create a factory for a Statamic collection?
- Create one factory class per collection or blueprint that declares the field values you want Faker to produce. Effort scales with content-model complexity, and nesting in Bard, Replicator and Grid plus asset and term relations take the most work. Start with one low-risk collection, compare the output against the manual seed data it replaces, then expand collection by collection.
- Can I use aerni/factory with Pest or PHPUnit tests?
- Generated entries are regular Statamic content, so you can create them in test setup with Pest or PHPUnit and assert against them like any other entry. Keep the factories checked in so tests and demo seeding share one source of truth. Use a fresh or ephemeral environment so test data does not leak into editorial content.
- Is aerni/factory actively maintained, and what are the alternatives?
- It is a single-maintainer package with roughly 19 stars and no dependents, so there is no downstream corpus to absorb a breakage. Pin the version, review it in dependency checks, and note that the Composer name aerni/factory differs from the repository name statamic-factory. The main alternative is a hand-rolled Faker seeder against Statamic's entry API, a few hundred lines that also serve as the escape hatch.
- How do I generate deterministic, referentially consistent fake content?
- Seed Faker's random source and set explicit IDs or slugs in your factory definitions so runs are repeatable. For relations, reference real asset containers, terms and entries that your seeder creates first instead of emitting random identifiers. Planning the seeding order, assets then terms then entries, keeps references valid.