2017 © Pedro Peláez
 

craft-plugin craft-seeder

Easy entries seeder for Craft CMS

image

studioespresso/craft-seeder

Easy entries seeder for Craft CMS

  • Friday, June 1, 2018
  • by janhenckens
  • Repository
  • 3 Watchers
  • 13 Stars
  • 480 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 4264 % Grown

The README.md

Seeder plugin for Craft CMS 3.x

Seeder, (*1)

Usage

Seeder allows you to quickly create dummy entries through the command line. And you can just as easily remove the dummy data when you're done building the site. With the plugin installed, running ./craft help seeder/generate will show you which commands are available, (*2)

Since the plugin is only usefull during the development and not on a live site, charging money for it would be stupid (you could just free trial it every time). Instead you can download it for free and if you want to support future development, you can support it on beerpay.io. Thanks!, (*3)

Beerpay, (*4)

Installation

To install the plugin, follow these instructions., (*5)

  1. Open your terminal and go to your Craft project:, (*6)

    cd /path/to/project
  2. Then tell Composer to load the plugin:, (*7)

    composer require studioespresso/craft-seeder
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for "Seeder"., (*8)

Usage

Entries (Section ID/handle, siteId, count)

Use the command below, followed by the --section option and the --number of entries you want to create (defaults to 20 if ommited). This command works with both section ID and handle., (*9)

You can also add a siteId parameter to seed entries for a specific site. This will use the default site as a fallback., (*10)

./craft seeder/generate/entries --section=news --count=15

Categories (Category group ID/handle, count)

./craft seeder/generate/categories --group=labels --count=10

Users (Usergroup ID/handle, count)

./craft seeder/generate/users --group=editors --count=5

Clean up

Once you're done building out the site, the plugin gives you an easy way to remove the dummy data (entries, assets, categories and users). This can be done through the CP (click the Seeder section the sidebar) or through the command line with the following command:, (*11)

./craft seeder/clean-up/all

Configuration options

eachMatrixBlock - Seed all blocktypes in a matrix field

For a matrix, the plugin will get a random set of block types within the minimum & maximum amounts of blocks the field allows., (*12)

With this setting set to true, we'll generate a block of each blocktype once in a random order. This is a good way to test pagebuilder/contentbuilder-like fields., (*13)

useLocalAssets - Use assets already in your site to seed asset fields

'useLocalAssets' => [
    'volumeId' => 1,
    'path' => 'test/'
]

Add the array above to config/seeder.php to seed using assets from volume 1 and folder test/., (*14)

fields - Basic field configuration

'fields' => [
    "sessions" => "ignore",
    "radioField" => [
        'value' => 'value2',
    ],
    "category" => [
        'mode' => 'random',
        'value' => [152, 153]
    ]
]

These are some basic examples of how you can defined seeding settings per field. The field handle should be the key in the array and the options are available right now: - "ignore" => skip the field when seeding - ["value" => "some string" ] => Works to set a fixed value for plain text fields, checkboxes, radio buttons. - ["mode" => "random", "value" => [1, 2] ] => Works with entries and category fields, values should be ids of those entries., (*15)

Troubleshooting

The most common problem with the plugins is getting the following error:, (*16)

Unknown command: seeder/generate/entries

If you have the plugin installed in the CP and are seeing this message, craft can not connect to your database through the command line. Your site probably works correctly but CLI commands won't., (*17)

If you're running MAMP/XAMP, you should use 127.0.0.1 as hostname instead of localhost., (*18)

Roadmap

Core elements

  • [x] Entries
  • [x] Categories
  • [x] Users
  • [x] Entry fields

Core fields

  • [x] Title
  • [x] Plain text
  • [x] Email
  • [x] Url
  • [x] Color
  • [x] Date
  • [x] Entries
  • [x] Categories
  • [x] Dropdown
  • [x] Checkboxes
  • [x] Radio buttons
  • [x] Multi select
  • [x] Assets
  • [x] Matrix
  • [x] Lightswitch
  • [x] Table
  • [x] Tags
  • [x] Users

Plugin elements

  • [ ] Commerce products & variants

Plugin fields

The Versions

01/06 2018

dev-develop

dev-develop

Easy entries seeder for Craft CMS

  Sources   Download

MIT

The Requires

 

The Development Requires

cms seeder craftcms craft-plugin craft

29/05 2018

dev-master

9999999-dev

Easy entries seeder for Craft CMS

  Sources   Download

MIT

The Requires

 

cms seeder craftcms craft-plugin craft

29/05 2018

1.0.3

1.0.3.0

Easy entries seeder for Craft CMS

  Sources   Download

MIT

The Requires

 

cms seeder craftcms craft-plugin craft

24/05 2018

dev-feature/commerce

dev-feature/commerce

Easy entries seeder for Craft CMS

  Sources   Download

MIT

The Requires

 

cms seeder craftcms craft-plugin craft

24/05 2018

1.0.2

1.0.2.0

Easy entries seeder for Craft CMS

  Sources   Download

MIT

The Requires

 

cms seeder craftcms craft-plugin craft

23/05 2018

1.0.1

1.0.1.0

Easy entries seeder for Craft CMS

  Sources   Download

MIT

The Requires

 

cms seeder craftcms craft-plugin craft

16/05 2018

1.0.0

1.0.0.0

Easy entries seeder for Craft CMS

  Sources   Download

MIT

The Requires

 

cms seeder craftcms craft-plugin craft