Download the PHP package log1x/poet without Composer

On this page you can find all versions of the php package log1x/poet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package poet

Poet

Latest Stable Version Total Downloads Build Status

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

Features

Requirements

Installation

Install via Composer:

Getting Started

Start with publishing the Poet configuration file using Acorn:

Usage

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:

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

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:

It is also possible to unregister an existing post type by simply passing 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:

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

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:

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:

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

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

For additional configuration options for taxonomies, please see:

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

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.

If no namespace is provided, the current theme's text domain will be used instead.

Registering a block in most cases is as simple as:

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:

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 <p></p> 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:

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

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

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:

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:

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:

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

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

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.

If no namespace is provided, the current theme's text domain will be used instead.

Registering a block in most cases is as simple as:

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.

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:

Registering a Block Pattern Category

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

You can specify all category properties such as label, as per the block editor handbook.

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

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.

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.

If you are using the Palette Webpack Plugin, you may also simply pass true to automatically use the generated palette.json during build.

Bug Reports

If you discover a bug in Poet, please open an issue.

Contributing

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

License

Poet is provided under the MIT License.


All versions of poet with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
johnbillion/extended-cpts Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package log1x/poet contains the following files

Loading the files please wait ....