Modern PHP abstractions for WordPress post types and taxonomies.
Migrating from v2 to v3
Important: v3.0 is a breaking release. Existing v2 post type and taxonomy definitions will not work without modification. Please review the migration guide in the documentation on how to upgrade to version 3.
Run the following in your terminal to install PostTypes with Composer.
$ composer require jjgrainger/posttypes
PostTypes uses PSR-4 autoloading and can be used with the Composer's autoloader. See Composer's basic usage guide for details on working with Composer and autoloading.
Basic Usage
Create a custom post type
Custom post types are defined as classes that extend the base PostType class. At a minimum, the name method must be implemented to define the post type slug. All other methods are optional and allow you to configure labels, options, taxonomies, admin columns, filters, and more as needed.
Register a custom post type
Once the custom post type class is created it can be registered to WordPress by instantiating and call the register method.