A modern PHP 8.2+ library for easily managing WordPress custom post types and taxonomies with a fluent interface and hexagonal architecture.
- π Modern PHP 8.2+ with type declarations
- ποΈ Fluent interface for easy configuration
- π§ Built on top of Extended CPTs library
- π Hexagonal architecture for better separation of concerns
- π§ͺ Fully tested with PestPHP
- π‘ Intuitive method naming with dedicated methods for boolean properties
composer require pollora/entity
- Post Types Documentation - Complete guide for creating and configuring custom post types
- Taxonomies Documentation - Complete guide for creating and configuring custom taxonomies
use Pollora\Entity\PostType; PostType::make('book', 'Book', 'Books') ->public() ->showInRest() ->hasArchive() ->supports(['title', 'editor', 'thumbnail']) ->menuIcon('dashicons-book-alt');
use Pollora\Entity\Taxonomy; Taxonomy::make('genre', 'book', 'Genre', 'Genres') ->hierarchical() ->showInRest() ->showInQuickEdit();
This package follows hexagonal architecture principles:
- Domain Layer: Core business logic (Entity, PostType, Taxonomy)
- Application Layer: Services that orchestrate operations
- Adapter Layer: WordPress integration adapters
The Domain layer remains independent of external dependencies, defining interfaces (ports) that adapters implement.
The package includes comprehensive unit tests using PestPHP with WordPress function mocks:
composer testtests/helpers.php: Global WordPress function mockstests/ext_cpts_helpers.php: Extended CPTs namespace function mockstests/bootstrap.php: Test environment setup
This package is open-source software licensed under the MIT license.