Fake Posts Generator
Generate realistic fake posts with Faker content and Picsum images for development and testing.
About this plugin
Fake Posts Generator - Contensio Plugin
Generate realistic fake posts for development and testing. Uses FakerPHP for text content and Picsum Photos for images.
Dev only. This plugin is intended for local and testing environments. A warning banner is shown in the admin UI if the app is running in any other environment.
Features
- Generate any number of fake posts (1–50 per batch via UI, up to 200 via Artisan)
- Choose content type, language, and taxonomy terms to assign
- Fetch and save real photographs from Picsum Photos (1600×900 px, 16:9)
- All fake posts are tagged with a
_fake_postmeta key for easy identification - One-click "Delete all fake posts" removes posts and their associated media files
- Artisan command for CI / scripted environments
Usage
Admin UI
Navigate to Settings → Fake Posts in the Contensio admin panel.
- Select a Content type
- Select a Language
- Set the number of posts (1–50)
- Optionally enable/disable image fetching
- Optionally check taxonomy terms to attach to each post
- Click Generate fake posts
To remove all test content, click Delete all fake posts on the same page.
Artisan command
php artisan contensio:fake-posts
Options:
| Option | Default | Description |
|---|---|---|
--count=N |
10 | Number of posts to generate |
--type=post |
first type | Content type name |
--terms=1,2,3 |
none | Comma-separated term IDs to attach |
--no-images |
false | Skip downloading images from Picsum |
--delete |
false | Delete all existing fake posts instead of generating |
Examples:
# Generate 20 posts with images
php artisan contensio:fake-posts --count=20
# Generate 5 posts of type "page" without images
php artisan contensio:fake-posts --count=5 --type=page --no-images
# Assign to terms 3, 7, and 12
php artisan contensio:fake-posts --count=10 --terms=3,7,12
# Delete all fake posts and their media
php artisan contensio:fake-posts --delete
How it works
Each generated post:
- Creates a
contentsrecord (status:published, randompublished_atwithin the past year) - Creates a
content_translationsrecord with Faker title, slug, excerpt, and HTML body paragraphs - Attaches selected terms via the
content_termspivot table - Inserts a
content_metarecord:meta_key = _fake_post,meta_value = 1
If images are enabled, each post also:
- Fetches a unique photo from
https://picsum.photos/seed/{random}/1600/900 - Saves the file to
storage/app/public/uploads/{year}/{month}/{uuid}.jpg - Creates a
mediarecord and amedia_translationsrecord (alt text via Faker) - Sets the post's
featured_image_id
Deletion
The _fake_post meta key is used to identify all fake posts regardless of other attributes. Deleting collects the featured_image_id values first, then deletes the content records (cascading to translations, meta, and terms), then deletes the media files from disk and the media records.
Requirements
- PHP
fakerphp/faker ^1.23(declared incomposer.json) - Network access to
picsum.photosfor image fetching (skippable with--no-images)