PHPackages                             log1x/poet - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. log1x/poet

ActivePackage[Utility &amp; Helpers](/categories/utility)

log1x/poet
==========

Configuration-based post type, taxonomy, editor color palette, block category, and block registration for Sage 10.

v2.1.0(2y ago)219293.1k↓56.3%15[4 issues](https://github.com/Log1x/poet/issues)1MITPHPPHP ^7.4|^8.0CI failing

Since Nov 10Pushed 2y ago8 watchersCompare

[ Source](https://github.com/Log1x/poet)[ Packagist](https://packagist.org/packages/log1x/poet)[ GitHub Sponsors](https://github.com/Log1x)[ RSS](/packages/log1x-poet/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (2)Versions (29)Used By (1)

Poet
====

[](#poet)

[![Latest Stable Version](https://camo.githubusercontent.com/705e0fe2457e569e6cf85905ed6e64fbe83c7687f289e8cb826376a1d78a6642/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f6731782f706f65743f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/705e0fe2457e569e6cf85905ed6e64fbe83c7687f289e8cb826376a1d78a6642/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f6731782f706f65743f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/bebf014ad517b4f18a813dda3ba9aa3c62a409fcee74492bcc63652f30579efe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f6731782f706f65743f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/bebf014ad517b4f18a813dda3ba9aa3c62a409fcee74492bcc63652f30579efe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f6731782f706f65743f7374796c653d666c61742d737175617265)[![Build Status](https://camo.githubusercontent.com/c09b1a0c9d7bf56cb704142db535fd1cb5a0529efec79c12eff7c6a34e576aff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f6731782f706f65742f4d61696e2e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/c09b1a0c9d7bf56cb704142db535fd1cb5a0529efec79c12eff7c6a34e576aff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f6731782f706f65742f4d61696e2e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)

Poet provides simple configuration-based post type, taxonomy, editor color palette, block category, block pattern and block registration/modification.

Features
--------

[](#features)

- Dead simple post type and taxonomy registration, modification, and unregistering powered by [Extended CPTs](https://github.com/johnbillion/extended-cpts).
- Easy editor color palette configuration including built-in support for [webpack-palette-plugin](https://github.com/roots/palette-webpack-plugin).
- Blocks registered are rendered using Laravel Blade on the frontend.
- Block Patterns registered can have their content defined using Laravel Blade too.
- Add additional block categories with nothing more than a slug.
- Move parent admin menu items to the `Tools` submenu using their page slug.

Requirements
------------

[](#requirements)

- [Sage](https://github.com/roots/sage) &gt;= 10.0
- [PHP](https://secure.php.net/manual/en/install.php) &gt;= 7.4
- [Composer](https://getcomposer.org/download/)

Installation
------------

[](#installation)

Install via Composer:

```
$ composer require log1x/poet
```

Getting Started
---------------

[](#getting-started)

Start with publishing the Poet configuration file using Acorn:

```
$ wp acorn vendor:publish --provider="Log1x\Poet\PoetServiceProvider"
```

Usage
-----

[](#usage)

### Registering a Post Type

[](#registering-a-post-type)

All configuration related to Poet is located in `config/poet.php`. Here you will find an example Book post type pre-configured with a few common settings:

```
'post' => [
    'book' => [
        'enter_title_here' => 'Enter book title',
        'menu_icon' => 'dashicons-book-alt',
        'supports' => ['title', 'editor', 'author', 'revisions', 'thumbnail'],
        'show_in_rest' => true,
        'has_archive' => false,
        'labels' => [
            'singular' => 'Book',
            'plural' => 'Books',
        ],
    ],
],
```

In it's simplest form, a post type can be created by simply passing a string:

```
'post' => [
    'book',
],
```

To modify an existing post type, simply treat it as if you are creating a new post type passing only the configuration options you wish to change:

```
'post' => [
    'post' => [
        'labels' => [
            'singular' => 'Article',
            'plural' => 'Articles',
        ],
    ],
],
```

It is also possible to unregister an existing post type by simply passing `false`:

```
'post' => [
    'book' => false,
],
```

Please note that some built-in post types (e.g. Post) can not be conventionally unregistered.

For additional configuration options for post types, please see:

- [`register_post_type()`](https://developer.wordpress.org/reference/functions/register_post_type/)
- [`register_extended_post_type()`](https://github.com/johnbillion/extended-cpts/wiki/Registering-Post-Types)

> **Note**: Do not nest configuration in a `config` key like shown in the Extended CPTs documentation.

### Registering a Taxonomy

[](#registering-a-taxonomy)

Registering a taxonomy is similar to a post type. Looking in `config/poet.php`, you will see a Genre taxonomy accompanying the default Book post type:

```
'taxonomy' => [
    'genre' => [
        'links' => ['book'],
        'meta_box' => 'radio',
    ],
],
```

The most relevent configuration option is `links` which defines the post type the taxonomy is connected to. If no link is specified, it will default to `post`.

To view an archive for the Genre taxonomy, copy the Blade template called `archive.blade.php` to a new file called `taxonomy-genre.blade.php`.

In it's simplest form, you can simply pass a string. The example below would create a Topic taxonomy for the Post post type:

```
'taxonomy' => [
    'topic',
],
```

As with post types, to modify an existing taxonomy, simply pass only the configuration options you wish to change:

```
'taxonomy' => [
    'category' => [
        'labels' => [
            'singular' => 'Section',
            'plural' => 'Sections',
        ],
    ],
],
```

Also like post types, you can easily unregister an existing taxonomy by simply passing `false`:

```
'taxonomy' => [
    'post_tag' => false,
    'category' => false,
],
```

For additional configuration options for taxonomies, please see:

- [`register_taxonomy()`](https://developer.wordpress.org/reference/functions/register_taxonomy/)
- [`register_extended_taxonomy()`](https://github.com/johnbillion/extended-cpts/wiki/Registering-taxonomies)

> **Note**: Do not nest configuration in a `config` key like shown in the Extended CPTs documentation.

### Registering a Block

[](#registering-a-block)

Poet provides an easy way to register a Gutenberg block with the editor using an accompanying Blade view for rendering the block on the frontend.

Blocks are registered using the `namespace/label` defined when [registering the block with the editor](https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#registerblocktype).

If no namespace is provided, the current theme's [text domain](https://developer.wordpress.org/themes/functionality/internationalization/#loading-text-domain) will be used instead.

Registering a block in most cases is as simple as:

```
'block' => [
    'sage/accordion',
],
```

#### Creating a Block View

[](#creating-a-block-view)

Given the block `sage/accordion`, your accompanying Blade view would be located at `views/blocks/accordion.blade.php`.

Block views have the following variables available:

- `$data` – An object containing the block data.
- `$content` – A string containing the InnerBlocks content. Returns `null` when empty.

By default, when checking if `$content` is empty, it is passed through a method to remove all tags and whitespace before evaluating. This assures that editor bloat like `nbsp;` or empty `` tags do not cause `$content` to always return `true` when used in a conditional.

If you do not want this behavior on a particular block, simply register it as an array:

```
'block' => [
    'sage/accordion' => ['strip' => false],
],
```

If you need to register block attributes using PHP on a particular block, simply pass the attributes in an array when registering:

```
'block' => [
    'sage/accordion' => [
        'attributes' => [
            'title' => [
                'default' => 'Lorem ipsum',
                'type' => 'string',
            ],
        ],
    ],
],
```

Consider an accordion block that is registered with a `title` and `className` attribute. Your view might look something like this:

```

  @isset ($data->title)
    {!! $data->title !!}
  @endisset

    {!! $content ?? 'Please feed me InnerBlocks.' !!}

```

### Registering a Block Category

[](#registering-a-block-category)

Poet provides an easy to way register, modify, and unregister Gutenberg block categories. Looking in the config, you will see a commented out example for a Call to Action category:

```
'block_category' => [
    'cta' => [
        'title' => 'Call to Action',
        'icon' => 'star-filled',
    ],
],
```

This would result in a block category with a slug of `cta`. Once your block category is registered, you must register a block to its slug before the category will appear in the editor.

In it's simplest form, you can simply pass a string:

```
'block_category' => [
    'my-cool-blocks',
],
```

which would result in a `my-cool-blocks` category automatically converting the slug to title case.

You can also specify the title by passing a value to your slug:

```
'block_category' => [
    'my-cool-blocks' => 'Best Blocks, World.',
],
```

Like post types and taxonomies, modifying an existing block category is the same as registering one:

```
'block_category' => [
    'layouts' => 'Sections',
    'common' => ['icon' => 'star-filled'],
],
```

You can unregister an existing block category by simply passing `false`:

```
'block_category' => [
    'common' => false,
],
```

### Registering a Block Pattern

[](#registering-a-block-pattern)

Poet can also register Block Patterns for you, with an optional Blade view for the content.

Patterns are registered using the `namespace/label` defined when [registering the pattern with the editor](https://developer.wordpress.org/reference/functions/register_block_pattern/).

If no namespace is provided, the current theme's [text domain](https://developer.wordpress.org/themes/functionality/internationalization/#loading-text-domain) will be used instead.

Registering a block in most cases is as simple as:

```
'block_pattern' => [
    'sage/hero' => [
        'title' => 'Page Hero',
        'description' => 'Draw attention to the main focus of the page, and highlight key CTAs',
        'categories' => ['all'],
    ],
],
```

You can register the actual content for the pattern here as well, using the `content` key. Or leave it blank to use a corresponding blade view.

```
'block_pattern' => [
    'sage/fake-paragraph' => [
        'title' => 'Fake Paragraph',
        'description' => 'Filler content used instead of actual content for testing purposes',
        'categories' => ['all'],
        'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ratione nulla culpa repudiandae nisi nostrum et, labore earum repellendus porro, mollitia voluptas quam? Modi sint tempore deleniti nesciunt ab, perferendis et.',
    ],
],
```

#### Creating a Pattern View

[](#creating-a-pattern-view)

Given the block `sage/fake-paragraph`, if no `content` key is defined, then your accompanying Blade view would be located at `views/block-patterns/fake-paragraph.blade.php`.

This Block Pattern view may look like this:

```

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ratione nulla culpa repudiandae nisi nostrum et, labore earum repellendus porro, mollitia voluptas quam? Modi sint tempore deleniti nesciunt ab, perferendis et.

```

### Registering a Block Pattern Category

[](#registering-a-block-pattern-category)

Block Pattern Categories can be added with the following code in the poet config:

```
'block_pattern_category' => [
    'all' => [
        'label' => 'All Patterns',
    ],
],
```

You can specify all category properties such as `label`, as per the [block editor handbook](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-patterns/#register_block_pattern_category).

> Note: Currently, if no Block Pattern Categories are available at all, the Block Patterns tab in the editor will crash when clicked on.

### Registering an Editor Color Palette

[](#registering-an-editor-color-palette)

Poet attempts to simplify registering a color palette with the editor a bit by not requiring such strict, fragile array markup.

While you can of course pass said array directly, you are also able to register colors by simply passing a slug along with a color and letting Poet handle the rest.

```
'palette' => [
    'red' => '#ff0000',
    'blue' => '#0000ff',
],
```

Alternatively to passing an array, Poet also accepts a `JSON` file containing your color palette. Poet will generally look for this file in `dist/` by default.

```
'palette' => 'colors.json',
```

If you are using the [Palette Webpack Plugin](https://github.com/roots/palette-webpack-plugin), you may also simply pass `true` to automatically use the generated `palette.json` during build.

```
'palette' => true,
```

Bug Reports
-----------

[](#bug-reports)

If you discover a bug in Poet, please [open an issue](https://github.com/log1x/poet/issues).

Contributing
------------

[](#contributing)

Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.

License
-------

[](#license)

Poet is provided under the [MIT License](LICENSE.md).

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 78% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~64 days

Recently: every ~210 days

Total

27

Last Release

734d ago

Major Versions

v1.1.5 → v2.0.02021-03-11

PHP version history (4 changes)v1.0.0PHP &gt;=7.2

v1.0.2PHP &gt;=7.2.5

v2.0.0PHP ^7.3|^8.0

v2.0.6PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5745907?v=4)[Brandon](/maintainers/Log1x)[@Log1x](https://github.com/Log1x)

---

Top Contributors

[![Log1x](https://avatars.githubusercontent.com/u/5745907?v=4)](https://github.com/Log1x "Log1x (46 commits)")[![huubl](https://avatars.githubusercontent.com/u/50170696?v=4)](https://github.com/huubl "huubl (3 commits)")[![marcelo2605](https://avatars.githubusercontent.com/u/2372927?v=4)](https://github.com/marcelo2605 "marcelo2605 (2 commits)")[![Jamiewarb](https://avatars.githubusercontent.com/u/2754728?v=4)](https://github.com/Jamiewarb "Jamiewarb (1 commits)")[![kellymears](https://avatars.githubusercontent.com/u/397606?v=4)](https://github.com/kellymears "kellymears (1 commits)")[![mike-sheppard](https://avatars.githubusercontent.com/u/1690006?v=4)](https://github.com/mike-sheppard "mike-sheppard (1 commits)")[![ouun](https://avatars.githubusercontent.com/u/32090713?v=4)](https://github.com/ouun "ouun (1 commits)")[![alexdanylyschyn](https://avatars.githubusercontent.com/u/13107995?v=4)](https://github.com/alexdanylyschyn "alexdanylyschyn (1 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")[![broskees](https://avatars.githubusercontent.com/u/18671860?v=4)](https://github.com/broskees "broskees (1 commits)")[![dotsam](https://avatars.githubusercontent.com/u/4316742?v=4)](https://github.com/dotsam "dotsam (1 commits)")

---

Tags

blockscustom-post-typescustom-taxonomiesgutenbergsage10wordpresswordpressgutenbergcpt

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/log1x-poet/health.svg)

```
[![Health](https://phpackages.com/badges/log1x-poet/health.svg)](https://phpackages.com/packages/log1x-poet)
```

###  Alternatives

[tiny-pixel/acorn-block-templates

Block templates for Sage 10

191.3k](/packages/tiny-pixel-acorn-block-templates)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
