Download the PHP package jordanbeattie/craftcms-faker without Composer

On this page you can find all versions of the php package jordanbeattie/craftcms-faker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craftcms-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

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

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

Usage

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.

Collection

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

Asset

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

Available attributes

Sources

You can select a source to be used when generating default images. You can choose Lorem Picsum (default), Placeholder 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

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

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

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

Query

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

Example

Super Table

Designed to mimic Super Table, 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.

Donkey Tail

Designed to replicate Donkey Tail, you can use this to replicate a DonkeyTail field and pass in your image and pins.

Available attributes

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

or if you had an asset within a Super Table field

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

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

Navigation

Designed to mimic Verbb's navigation plugin, the navigation function will accept an integer for the total amount of items to return and will provide a Collection of items, each with:

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

Contact

Jordan Beattie
[email protected]
Aberdeen, Scotland


All versions of craftcms-faker with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3|^4.0.0-alpha
php Version ^8.0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jordanbeattie/craftcms-faker contains the following files

Loading the files please wait ....