Download the PHP package martinsluters/wpregistrars without Composer

On this page you can find all versions of the php package martinsluters/wpregistrars. 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 wpregistrars

WP Registrars

Introduction

In a nutshell the WP Registrars is a small PHP library which allows to register WordPress post types and taxonomies in bulk. Labels are made in plural form and uppercase where required to make development faster.

Minimum Requirements

Installation

You can install the WP Registrars with composer:

composer require martinsluters/wpregistrars

Usage

It is relatively easy to use the library, you can use factories martinsluters\WPRegistrars\Factories\BulkRegistrarPostTypesFactory and martinsluters\WPRegistrars\Factories\BulkRegistrarTaxonomiesFactory to create new martinsluters\WPRegistrars\Registrars\BulkRegistrarPostTypes and martinsluters\WPRegistrars\Registrars\BulkRegistrarTaxonomies registrar instances.

Note: This documentation will not cover the appropriate place and time in WordPress action execution order to use the library.

Hint: Post type and taxonomy registrations should not be hooked before the ‘init’ action.

Usage of factory build methods

withArguments( array $arguments )

It is mandatory to use this method to register custom post type or custom taxonomy. At the most minimal configuration it requires an indexed array passed with at least one element with a string type value. withArguments( [ 'report' ] ) The string is considered as the post type or taxonomy key. You can pass in theory an unlimited number of elements.

It is possible to pass additional registration arguments. By setting an array element with a string type key (to be considered as post type or taxonomy key) and array type element value. Array passed to the value is what you would normally pass when registering a post type and taxonomy. withArguments( [ 'report' => [ 'public' => true ] ] )

To pass object type(s) when registering a taxonomy use the following withArguments( [ 'guide_language' => [ 'object_type' => [ 'guide', 'report' ] ] ] )

Arguments passed to withArguments takes over arguments passed to withDefaultRegistrationArguments.

withDefaultRegistrationArguments( array $default_registration_arguments )

It is possible to set default registration arguments that will be applied to all post types or taxonomies. Array passed is what you would normally pass when registering a post type and taxonomy.

withDefaultRegistrationArguments( [ 'public' => true ] )

An exception is passing taxonomy registration object type(s). You can pass them along with registration arguments array using the following format

withDefaultRegistrationArguments( [ 'object_type' => [ 'guide', 'report' ] ] )

Arguments passed to withDefaultRegistrationArguments.

shouldAutoPluralize( bool $should_auto_pluralize_label )

By default labels of post type or taxonomy are made in plural form where it is required using post type or taxonomy key as source. It is possible to disable the feature using shouldAutoPluralize( false ). If withDefaultRegistrationArguments or withArguments provides array element label then shouldAutoPluralize has no effect.

withPluralizer( PluralizerInterface $pluralizer )

By default labels of post type and taxonomy are made in plural English form using Doctrine\Inflector\Inflector that is a dependency for the library. It is possible to change the language used by providing a different language using Doctrine\Inflector\Language

Note: Please see the official documentation of Doctrine\Inflector to find the supported languages.

You can use a different tool to make words in a plural form and disregard Doctrine\Inflector completely. To do so you must provide to withPluralizer an adapter that implements martinsluters\WPRegistrars\PluralizerInterface.

shouldAutoCapitalize( bool $should_auto_capitalize_label )

By default labels of post type or taxonomy are made in a way that first character of each word in string is capitalized, if that character is alphabetic. The source of label is post type or taxonomy key. It is possible to disable the feature using shouldAutoCapitalize( false ). If withDefaultRegistrationArguments or withArguments provides array element label then shouldAutoCapitalize has no effect.

create()

Creates registrar instance if it is possible.

Usage of registrar methods

register()

Registers either post types or taxonomies.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


All versions of wpregistrars with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
doctrine/inflector Version ^2.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 martinsluters/wpregistrars contains the following files

Loading the files please wait ....