studioespresso/craft-seeder
最新稳定版本:3.3.1
Composer 安装命令:
composer require studioespresso/craft-seeder
包简介
Easy entries seeder for Craft CMS
README 文档
README
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
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!
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project -
Then tell Composer to load the plugin:
composer require studioespresso/craft-seeder -
In the Control Panel, go to Settings → Plugins and click the “Install” button for "Seeder".
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.
You can also add a siteId parameter to seed entries for a specific site. This will use the default site as a fallback.
./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:
./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.
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.
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/.
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.
Troubleshooting
The most common problem with the plugins is getting the following error:
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.
If you're running MAMP/XAMP, you should use 127.0.0.1 as hostname instead of localhost.
Roadmap
Core elements
- Entries
- Categories
- Users
- Entry fields
Core fields
- Title
- Plain text
- Url
- Color
- Date
- Entries
- Categories
- Dropdown
- Checkboxes
- Radio buttons
- Multi select
- Assets
- Matrix
- Lightswitch
- Table
- Tags
- Users
Plugin elements
- Commerce products & variants
Plugin fields
studioespresso/craft-seeder 适用场景与选型建议
studioespresso/craft-seeder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.98k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2018 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「seeder」 「Craft」 「craftcms」 「craft-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 studioespresso/craft-seeder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 studioespresso/craft-seeder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 studioespresso/craft-seeder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Expand, collapse, change the status of, or delete multiple blocks in a Matrix field simultaneously.
Philippines region, province, cities/municipalities and barangays Laravel migration and table seeder.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Versioned, environment-based Seeders in Laravel. Used while original does not update to Laravel 5.7
统计信息
- 总下载量: 17.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 30
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-08
