PHP API

Last updatedView as Markdown

Symbols defined in plugin-scaffold.php, includes/functions.php, and the public classes under includes/. Private methods are omitted.

Constants

Defined in plugin-scaffold.php. dev/phpstan/constants.php repeats them for static analysis and is not loaded at runtime.

Reference

Plugin constants

Typed options, defaults, and constraints in one scannable reference.
6 fields
PLUGIN_SCAFFOLD_FILE string required
Absolute path of plugin-scaffold.php.
PLUGIN_SCAFFOLD_PATH string required
Plugin directory path with trailing slash.
PLUGIN_SCAFFOLD_URL string required
Plugin directory URL.
PLUGIN_SCAFFOLD_BASENAME string required
plugin-scaffold/plugin-scaffold.php in a normal install.
PLUGIN_SCAFFOLD_BLOCK_PATH string required
Always defined. The blocks directory exists only after the blocks overlay is applied.
PLUGIN_SCAFFOLD_VERSION string required
Plugin header version. Surrounded by x-release-please version comments.

Functions

Reference

Procedural functions

Typed options, defaults, and constraints in one scannable reference.
3 fields
plugin_scaffold_init any required
void. Hooked to plugins_loaded. Instantiates Bootstrap and calls run(), or adds the missing-autoloader admin notice.
plugin_scaffold_missing_autoloader_notice any required
void. Prints an error notice when Bootstrap cannot be loaded. Requires current_user_can( ‘activate_plugins’ ).
plugin_scaffold_version string required
Returns PLUGIN_SCAFFOLD_VERSION, or 0.0.0 if that constant is not defined. Guarded with function_exists.

Classes

Linchpin\Plugin_Scaffold\Core\Bootstrap

Reference

Bootstrap public methods

Typed options, defaults, and constraints in one scannable reference.
2 fields
run any required
void. Loads controllers, calls register_actions() on each, then do_action( ‘plugin_scaffold_ready’, $this ).
get_controller any required
get_controller( string $name ): Controller_Interface|null. $name is the class name relative to the Controller namespace, for example Install.

Linchpin\Plugin_Scaffold\Controller\Controller_Interface

Reference

Controller_Interface

Typed options, defaults, and constraints in one scannable reference.
1 field
register_actions any required
void. Register the WordPress hooks this controller listens on.

Linchpin\Plugin_Scaffold\Controller\Install

Implements Controller_Interface.

Reference

Install

Typed options, defaults, and constraints in one scannable reference.
3 fields
register_actions any required
void. Empty. Activation is registered from plugin-scaffold.php.
activate any required
static void. Fires plugin_scaffold_activated.
deactivate any required
static void. Empty. Comment in source: data stays.

Linchpin\Plugin_Scaffold\Helper\Files

final class.

Reference

Files

Typed options, defaults, and constraints in one scannable reference.
1 field
glob_recursive array required
glob_recursive( string $pattern, int $flags = 0 ): string[]. glob() that descends into subdirectories. Used by Bootstrap to find controllers.

Actions

Reference

do_action hooks

Typed options, defaults, and constraints in one scannable reference.
2 fields
plugin_scaffold_ready any required
Fires once every controller has registered its hooks. Argument: Bootstrap $bootstrap.
plugin_scaffold_activated any required
Fires from Install::activate after activation. No arguments.
php plugin-scaffold.php
add_action( 'plugins_loaded', 'plugin_scaffold_init' );register_activation_hook( __FILE__, [ \Linchpin\Plugin_Scaffold\Controller\Install::class, 'activate' ] );register_deactivation_hook( __FILE__, [ \Linchpin\Plugin_Scaffold\Controller\Install::class, 'deactivate' ] );
WordPress hooks registered from the main file.

Overlay-only symbols

Linchpin\Plugin_Scaffold\Controller\Blocks and the linchpin/example block are not in this checkout's runtime. They are documented on the blocks overlay page.

Have a question about this page?

Linchpin assistant

Was this helpful?