acobster/wp-cli-yaml-fixtures
Composer 安装命令:
composer require acobster/wp-cli-yaml-fixtures
包简介
Define WordPress database snapshots as simple YAML files
README 文档
README
A WP-CLI command for describing your WordPress database content in, and importing from, YAML files. Built for testing and scaffolding quickly.
Getting Started
Install and activate this repo as a plugin.
git clone git@github.com:acobster/wp-yaml-fixtures.git ./wp-content/plugins/yaml-fixtures
wp plugin activate yaml-fixtures
Set up a YAML file.
---
# my-example.yaml
name: My Test Site
description: Just another database described in YAML
users:
- email: admin@example.com
login: admin
role: administrator
password: meep
posts:
- title: My Blog Post
type: post
content: 'Lorem ipsum dolor sit amet'
terms:
category:
- special
taxonomies:
category:
- name: Special
- name: Snowflake
- name: Unicorn
...
Run the WP-CLI command.
wp fixture install my-example.yaml
💥 Your database has now been cleaned and populated with fresh data. 💥
YAML for Days!
Here's a more in-depth example of the kinds of things you can describe in your YAML:
---
name: My Test Site
description: Just another database described in YAML
# tell me what **not** to delete
blank_slate:
preserve_users:
- me
- myself
- i@email.me
- 123 # ID
# insert users
users:
- email: admin@example.com
login: admin
role: administrator
password: meep
- email: johndoe@example.com
login: johndoe
role: editor
password: mop
meta:
my_info: 'This info is v important'
moar_info: 'here iz sum moar infoz'
# insert arbitrary post data
posts:
- title: My Blog Post
type: post
- title: Page with a Custom Slug
slug: yep-this-heres-a-completely-custom-slug
type: page
content: |
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nunc haec primum fortasse audientis servire debemus.
Sumenda potius quam expetenda.
Mihi quidem Homerus huius modi quiddam vidisse videatur in iis,
quae de Sirenum cantibus finxerit.
Ut in geometria, prima si dederis, danda sunt omnia.
# specify any number of terms, across taxonomies
terms:
page_type:
- custom-term-slug
category:
- special
- title: A Post with Some Meta Fields
type: page
# oh and I want to nest this page
parent: bar
# specify arbitrary meta fields
meta:
my_custom_field: Some custom value
# specify multiple values for the same key!
# these will be inserted as three wp_postmeta rows
another_field:
- 'value #1'
- 'value #2'
- 'value #3'
terms:
page_type:
- custom-term-slug
- another
- and-another
# Define taxonomy terms
taxonomies:
category:
- name: Special
- name: Snowflake
- name: Unicorn
page_type:
- name: Page Type
slug: custom-term-slug
- name: Another Page Type
slug: another
- name: And Another
...
Support
WP YAML Fixtures supports WordPress 4.8+ and PHP 7.0 through 7.2.x. Support for PHP 7.3 is a work in progress.
License
MIT
acobster/wp-cli-yaml-fixtures 适用场景与选型建议
acobster/wp-cli-yaml-fixtures 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.4k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 acobster/wp-cli-yaml-fixtures 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 acobster/wp-cli-yaml-fixtures 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-02