goodwp/goodenberg
Composer 安装命令:
composer require goodwp/goodenberg
包简介
Goodenberg is a library of components, helpers and examples for building modern WordPress sites and applications withthe block editor and all other features introduced with Gutenberg.
关键字:
README 文档
README
Goodenberg is a library of components, helpers and examples for building modern WordPress sites and applications with the block editor and all other features introduced with Gutenberg.
Warning
This package is under active development and not considered stable, breaking changes can be added. I'm using the package on a few sites and some custom plugins successfully, but am still developing, optimizing and documenting it at the moment.
Table of Contents
Versioning / Supported WordPress versions
The library will follow SemVer versioning. Major versions and breaking changes will be kept to a minimum. Each minor version will support the latest stable WordPress version at the time of release. Development versions will try to work with newer Gutenberg versions.
Current supported WordPress version: WordPress 6.5
JavaScript / React
All JavaScript code is developed inside the src directory.
Usage
- Install the package via
npm install @goodwp/goodenberg - Use
@wordpress/scriptsfor an easy build process and to automatically extract dependencies - Use single components/hooks/etc
- All submodules (see below) can be imported from the submodules entrypoint
import {Page} from "@goodwp/goodenberg/admin/components"; - All submodules also provide directory-based imports:
import {Page} from "@goodwp/goodenberg/admin/components/page";
- All submodules (see below) can be imported from the submodules entrypoint
Architecture
The library only uses babel with the @wordpress/babel-preset-default preset to transpile each single js file, but does
not have any other build-process. It is suggested to use
@wordpress/scripts or a custom webpack config to bundle it.
Styles are created via @emotion to avoid requiring an additional stylesheet.
Components (components)
React components to be used in your admin screens or custom blocks.
- EntityRecordsSelect: A component which allows a user to select multiple records ( post, term, etc.).
- EntityRecordSelect: A component which allows a user to select a single record ( post, term, etc.).
Admin (admin)
React components, hooks, and utils for building pages in the wp-admin. Useful for building custom plugin pages, settings pages, etc. To be used together with @wordpress/components.
Components
-
Page: A component to build a complete wp-admin page, including header, content, notices.
-
Page.Header: A header bar for wp-admin pages.
-
AdminNotices: A "slot" which will render all admin notices that were rendered on the server
-
Bar: A full-width navigation bar for headers/footers on admin pages (used in Page.Header).
-
Container: A centered container which has a configurable default max-width.
-
TabPanel: A styled version of WordPress TabPanel component to be used on admin pages right beneath your Page.Header.
Router
A simple "router" to render some components based on a current active "route". There are two implementations (one for URL-based routing, on for state-based routing). Both provide a similar API.
Hooks (hooks)
React hooks to be used in your admin screens or custom blocks.
useApiFetch: A hook wrapper around theapiFetchfunction from core.useLocation/useHistory: A hook to use the URL/window.location and history object to use browser navigation.
Utils (utils)
Handy utility functions.
getBlockStyle(className: string): Get the selected/applied block style by its classname.onBlockRegistration(blockName, namespace, callback): Allows hooking into the registerBlockType hook of a specific block. Avoid having to check for the block name in your callback.onBlockEdit(blockName, namespace, callback, higherOrderComponent = false): Allows hooking into the BlockEdit hook of a specific block. Avoid having to check for the block name in your callback.
PHP
All PHP code is developed inside the lib directory.
Usage
- Install the package via
composer require goodwp/goodenberg - Load your composers autoload file in your plugin/theme.
- Use the classes and helpers.
Examples
The examples directory contains a plugin which uses a lot of the components. You can also test this plugin via @wordpress/env:
- Clone the repository
- Run
npm install - Run
npm env:start - Open
http://localhost:8888/wp-adminand login withadmin/password - Activate the plugin and open the example pages.
You can also use WordPress Playground to directly see the examples in a browser:
- Download the examples plugin from the latest release.
- Go to https://playground.wordpress.net/
- Upload and activate the plugin
- Go to the new admin page "Goodenberg examples"
Bugs, Issues, Security Issues, Feature Requests
Visit our GitHub Repository.
Inspired by 10up/block-components.
goodwp/goodenberg 适用场景与选型建议
goodwp/goodenberg 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 601 次下载、GitHub Stars 达 23, 最近一次更新时间为 2024 年 03 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「wp」 「blocks」 「gutenberg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 goodwp/goodenberg 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 goodwp/goodenberg 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 goodwp/goodenberg 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Blocks for NetCommons Plugin
Create Gutenberg blocks from Twig templates and ACF fields.
A block that displays featured content - large image, title, description and link.
Flexslider slideshow content block for Silverstripe Elemental
A block to display a list of links to child pages, or pages in current level
Collection of useful and reusable SilverStripe Elemental stylings properties
统计信息
- 总下载量: 601
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2024-03-31