定制 moderntribe/square1-generators 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

moderntribe/square1-generators

Composer 安装命令:

composer require moderntribe/square1-generators

包简介

Code generators for Square One

README 文档

README

A code generator utility to automate some of the repetitive tasks of building out a project with Square One. The WP CLI commands provided by this package will create stub files to set you on the right path for your custom work.

Component Generator

wp s1 generate component <component>

Generates the assorted files required for a theme component.

Example usage:

wp s1 generate component link

This will create six files for you in the theme:

  • components/link/link.php
  • components/link/Link_Controller.php
  • components/link/index.pcss
  • components/link/css/link.pcss
  • components/link/index.js
  • components/link/js/link.js

The template (link.php) and the Controller class (Link_Controller.php) will be stubbed out with common properties.

Use --no-template to skip the template.

Use --no-controller to skip the Controller class.

Use --no-css to skip the CSS files.

Use --no-js to skip the JS files.

The --dry-run flag will show you the files the command would create, without writing to the file system.

You can use this command to generate components in nested directories. For example, wp s1 generate component content/event ... would create the component in components/content/event. All PHP classes will have their namespaces adjusted to reflect their position in the hierarchy.

Post Type Generator

wp s1 generate cpt <cpt> [--single=<single>] [--plural=<plural>]

Generates the files required for a custom post type.

Example usage:

wp s1 generate cpt document --single="Document" --plural="Documents"

This will create three files for you in the core plugin:

  • src/Post_Types/Document/Document.php
  • src/Post_Types/Document/Config.php
  • src/Post_Types/Document/Subscriber.php

And it will add a reference to the subscriber in Tribe\Project\Core.

Taxonomy Generator

wp s1 generate tax <taxonomy> [--post-types=<post-types>] [--single=<single>] [--plural=<plural>]

Generates the files required for a custom taxonomy.

Example usage:

wp s1 generate tax classification --post-types="page,post" --single="Classification" --plural="Classifications"

This will create three files for you in the core plugin:

  • src/Taxonomies/Classification/Classification.php
  • src/Taxonomies/Classification/Config.php
  • src/Taxonomies/Classification/Subscriber.php

And it will add a reference to the subscriber in Tribe\Project\Core.

Block Generator

wp s1 generate block <name>

Generate the files required to register a new block with ACF.

Example usage:

wp s1 generate block image-gallery

This will create two files for you in the core plugin:

  • src/Blocks/Types/Image_Gallery/Image_Gallery.php
  • src/Blocks/Types/Image_Gallery/Image_Gallery_Model.php

And create the block template in the theme:

  • blocks/imagegallery.php

And then delegates to the component generator (see above) to generate the image_gallery component.

The --dry-run flag will show you the files the command would create, without writing to the file system.

Example with Post Loop Field Middleware:

wp s1 generate block image-gallery --with-post-loop-field-middleware

Settings Page Generator

TODO: write documentation for the settings page generator

CLI Command Generator

TODO: write documentation for the CLI command generator

Image Size Generator

wp s1 generate image-size <name> [--width=<width>] [--height=<height>] [--ratio=<ratio>] [--crop=<crop>]

Adds an image size to the core plugin's Image_Sizes class.

Example usage:

wp s1 generate image-size test-size --width=1000 --ratio=0.75 --crop=left,top

This will add the constant TEST_SIZE to the Image_Sizes class and add this definition to the $sizes array:

self::TEST_SIZE => [
	'width'  => 1000,
	'height' => 750,
	'crop'   => [ 'left', 'top' ],
]

moderntribe/square1-generators 适用场景与选型建议

moderntribe/square1-generators 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.35k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 moderntribe/square1-generators 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 moderntribe/square1-generators 我们能提供哪些服务?
定制开发 / 二次开发

基于 moderntribe/square1-generators 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.35k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 19
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2019-08-02