PHPackages                             jordanbeattie/craftcms-faker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jordanbeattie/craftcms-faker

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

jordanbeattie/craftcms-faker
============================

Fake entry fields for CraftCMS

2.0.2(2y ago)01.9k↓50%2[2 issues](https://github.com/jordannbeattie/craftcms-faker/issues)PHPPHP ^8.0.2

Since Mar 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jordannbeattie/craftcms-faker)[ Packagist](https://packagist.org/packages/jordanbeattie/craftcms-faker)[ RSS](/packages/jordanbeattie-craftcms-faker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (18)Used By (0)

Craft CMS Faker
===============

[](#craft-cms-faker)

Craft CMS Faker provides a handful of models that you can create an instance of in your Twig code to "fake" various components of Craft CMS.

For example, if you're passing an image to a template, you can access the attributes of the "fake" image just as you would with an Asset from Craft CMS.

Installation
------------

[](#installation)

To install the plugin, require it as a composer dependancy as follows:

```
composer require jordanbeattie/craftcms-faker

```

You can then install the plugin via the plugins section of Craft or by running the following command.

```
php craft plugin/install faker

```

Usage
-----

[](#usage)

### Entry

[](#entry)

Designed to fake a CMS entry, the Entry model can accept any attributes and be assigned to the returned model. To access the attributes passed in, use the `get()` function.

```
craft.faker.entry({
    title: "My entry",
    myCustomField: "My custom field value"
}).get();

```

### Collection

[](#collection)

A collection allows you to run the functions `all()`, `nth()` and `first()` on any array. Helpful for looping in your Twig templates

```
craft.faker.collection([
    "my first item",
    "my second item"
])

```

### Asset

[](#asset)

Designed to mimic an asset from Craft's asset volumes, this can be used in many different ways.

#### Available attributes

[](#available-attributes)

- url
- title
- alt
- kind
- source
- width
- height
- text
- id
- query

#### Sources

[](#sources)

You can select a source to be used when generating default images. You can choose [Lorem Picsum](https://picsum.photos) *(default)*, [Placeholder](https://placeholder.com) or Unsplash.

This can either be selected in the CMS Settings and can be set to a ENV variable.

You can also overwrite this setting per image by passing the `source` attribute with either `picsum`, `placeholder` or `unsplash` as the value.

#### Default URL

[](#default-url)

If no URl is passed to the function, a URL will be created for you using your selected source (see above). If you want an image generated automatically, simply do not include the URL attribute, instead you can optionally pass a height and width.

#### Sizing

[](#sizing)

You can pass `width` and `height` if you require. This is useful for passing images that are later transformed. Both will default to 200.

#### ID

[](#id)

When using `unsplash`, you can pass an id to select a specific image.

#### Query

[](#query)

When using `unsplash`, you can pass a query string to retrieve images related to the query.

#### Example

[](#example)

```
craft.faker.asset({
    url: "my-image-url",
    title: "Fake image",
    alt: "My fake image",
    kind: "image"
})

craft.faker.asset({
    source: "placeholder"
    width: 1080,
    height: 720
})

```

### Super Table

[](#super-table)

Designed to mimic [Super Table](https://verbb.io/craft-plugins/super-table/features), this is identical to using Collections. Simply pass in an array of data to access. Each array item should be wrapped in curly brackets to mimic a row.

```
craft.faker.superTable([
    {
        myColumnName: "my first columns data",
        mySecondColumnName: "my second columns data",
    },
    {
        myColumnName: "my first columns data",
        mySecondColumnName: "my second columns data",
    },
])

```

### Donkey Tail

[](#donkey-tail)

Designed to replicate [Donkey Tail](https://simplygoodwork.com/blog/donkeytail-use-cases-for-craft-cms), you can use this to replicate a DonkeyTail field and pass in your image and pins.

#### Available attributes

[](#available-attributes-1)

- Image
- Pins

```
craft.faker.donkeytail({
    image: yourAssetField,
    pins: [
        {
            x: 10,
            y: 10,
            element: yourElementField
        }
    ]
})

```

Each of the functions can be combined and used within each other. For example, if you had a collection of assets:

```
craft.faker.collection([
    craft.faker.asset(),
    craft.faker.asset(),
    craft.faker.asset()
])

```

or if you had an asset within a Super Table field

```
craft.faker.superTable([
    {
        image: craft.faker.asset()
    }
])

```

You can even fake entries and assets within a Donkey Tail field.

```
craft.faker.donkeytail({
    image: craft.faker.asset(),
    pins: [
        {
            x: 10,
            y:10,
            element: craft.faker.entry()
        }
    ]
})

```

If not provided in the attributes, the model will automatically assign a title, URL, slug and postDate.

### Navigation

[](#navigation)

Designed to mimic [Verbb's navigation plugin](https://verbb.io/craft-plugins/navigation/features), the navigation function will accept an integer for the total amount of items to return and will provide a Collection of items, each with:

- url
- title
- active
- newWindow
- customAttributes
- hasDescendants
- children

If you would like to return multi-level navigation, you can add a `true` second parameter. This currently only supports two levels.

```
craft.faker.navigation(4)
craft.faker.navigation(4, true)

```

Contact
-------

[](#contact)

Jordan Beattie

Aberdeen, Scotland

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~45 days

Total

16

Last Release

854d ago

Major Versions

1.0.9 → 2.0.02022-07-01

1.1.2 → 2.0.12023-12-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/386767c01607b6d47904c71fd4f101c309183b826e047b32c41a8c76de4e8720?d=identicon)[jordannbeattie](/maintainers/jordannbeattie)

---

Top Contributors

[![jordannbeattie](https://avatars.githubusercontent.com/u/6815944?v=4)](https://github.com/jordannbeattie "jordannbeattie (2 commits)")

---

Tags

cmsCraftcraftcmscraft-plugin

### Embed Badge

![Health badge](/badges/jordanbeattie-craftcms-faker/health.svg)

```
[![Health](https://phpackages.com/badges/jordanbeattie-craftcms-faker/health.svg)](https://phpackages.com/packages/jordanbeattie-craftcms-faker)
```

###  Alternatives

[verbb/navigation

Create navigation menus for your site.

90683.7k17](/packages/verbb-navigation)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.1k](/packages/verbb-comments)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[supercool/tablemaker

Create customizable and user-defined table fields.

40141.7k](/packages/supercool-tablemaker)[pennebaker/craft-architect

CraftCMS plugin to generate content models from JSON/YAML data.

72148.5k5](/packages/pennebaker-craft-architect)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
