Download the PHP package cedaro/wp-plugin without Composer

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

WordPress Plugin Library

Adds some structure to your WordPress plugins.

Requires PHP 8.0+.

Installation

To use this library in your project, add it to composer.json:

Creating a Plugin

A plugin is a simple object created to help bootstrap functionality by allowing you to easily retrieve plugin information, reference internal files and URLs, and register hooks.

$stucture is an instance of Plugin and implements the PluginInterface, which provides a basic API to access information about the plugin.

Hook Providers

Related functionality can be encapsulated in a class called a "hook provider" that's registered when bootstrapping the plugin.

Hook providers allow you to encapsulate related functionality, maintain state without using globals, namespace methods without prefixing functions, limit access to internal methods, and make unit testing easier.

For an example, the Cedaro\WP\Plugin\Provider\I18n class is a default hook provider that automatically loads the text domain so the plugin can be translated.

The only requirement for a hook provider is that it should implement the HookProviderInterface by defining a method called register_hooks().

Hook providers are registered with the main plugin instance by calling Plugin::register_hooks() like this:

The BookPostType provider might look something like this:

Protected Hook Callbacks

In WordPress, it's only possible to use public methods of a class as hook callbacks, but in the BookPostType hook provider above, the callbacks are protected methods of the class.

Locking down the API like that is possible using the HooksTrait developed by John P. Bloch.

Plugin Awareness

A hook provider may implement the PluginAwareInterface to automatically receive a reference to the plugin when its hooks are registered.

For instance, in this class the enqueue_assets() method references the internal $plugin property to retrieve the URL to a JavaScript file in the plugin.

Another example is the I18n provider mentioned earlier. It receives a reference to the plugin object so that it can use the plugin's base name and slug to load the text domain.

Classes that extend AbstractHookProvider are automatically "plugin aware."

License

Copyright (c) 2017 Cedaro, LLC

This library is licensed under MIT.

Attribution is appreciated, but not required.


All versions of wp-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
psr/container 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 cedaro/wp-plugin contains the following files

Loading the files please wait ....