---
title: PHP API
---

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.

<!-- wp:docspress/fields {"title":"Plugin constants","fields":[{"name":"PLUGIN_SCAFFOLD_FILE","type":"string","required":true,"defaultValue":"__FILE__","description":"Absolute path of plugin-scaffold.php.","values":"","deprecated":false},{"name":"PLUGIN_SCAFFOLD_PATH","type":"string","required":true,"defaultValue":"plugin_dir_path( __FILE__ )","description":"Plugin directory path with trailing slash.","values":"","deprecated":false},{"name":"PLUGIN_SCAFFOLD_URL","type":"string","required":true,"defaultValue":"plugin_dir_url( __FILE__ )","description":"Plugin directory URL.","values":"","deprecated":false},{"name":"PLUGIN_SCAFFOLD_BASENAME","type":"string","required":true,"defaultValue":"plugin_basename( __FILE__ )","description":"plugin-scaffold/plugin-scaffold.php in a normal install.","values":"","deprecated":false},{"name":"PLUGIN_SCAFFOLD_BLOCK_PATH","type":"string","required":true,"defaultValue":"plugin_dir_path( __FILE__ ) . 'blocks/'","description":"Always defined. The blocks directory exists only after the blocks overlay is applied.","values":"","deprecated":false},{"name":"PLUGIN_SCAFFOLD_VERSION","type":"string","required":true,"defaultValue":"0.1.0","description":"Plugin header version. Surrounded by x-release-please version comments.","values":"","deprecated":false}],"searchable":true,"compact":false} /-->

## Functions

<!-- wp:docspress/fields {"title":"Procedural functions","fields":[{"name":"plugin_scaffold_init","type":"any","required":true,"defaultValue":"","description":"void. Hooked to plugins_loaded. Instantiates Bootstrap and calls run(), or adds the missing-autoloader admin notice.","values":"","deprecated":false},{"name":"plugin_scaffold_missing_autoloader_notice","type":"any","required":true,"defaultValue":"","description":"void. Prints an error notice when Bootstrap cannot be loaded. Requires current_user_can( 'activate_plugins' ).","values":"","deprecated":false},{"name":"plugin_scaffold_version","type":"string","required":true,"defaultValue":"","description":"Returns PLUGIN_SCAFFOLD_VERSION, or 0.0.0 if that constant is not defined. Guarded with function_exists.","values":"","deprecated":false}],"searchable":true,"compact":false} /-->

## Classes

### `Linchpin\Plugin_Scaffold\Core\Bootstrap`

<!-- wp:docspress/fields {"title":"Bootstrap public methods","fields":[{"name":"run","type":"any","required":true,"defaultValue":"","description":"void. Loads controllers, calls register_actions() on each, then do_action( 'plugin_scaffold_ready', $this ).","values":"","deprecated":false},{"name":"get_controller","type":"any","required":true,"defaultValue":"","description":"get_controller( string $name ): Controller_Interface|null. $name is the class name relative to the Controller namespace, for example Install.","values":"","deprecated":false}],"searchable":false,"compact":false} /-->

### `Linchpin\Plugin_Scaffold\Controller\Controller_Interface`

<!-- wp:docspress/fields {"title":"Controller_Interface","fields":[{"name":"register_actions","type":"any","required":true,"defaultValue":"","description":"void. Register the WordPress hooks this controller listens on.","values":"","deprecated":false}],"searchable":false,"compact":true} /-->

### `Linchpin\Plugin_Scaffold\Controller\Install`

Implements `Controller_Interface`.

<!-- wp:docspress/fields {"title":"Install","fields":[{"name":"register_actions","type":"any","required":true,"defaultValue":"","description":"void. Empty. Activation is registered from plugin-scaffold.php.","values":"","deprecated":false},{"name":"activate","type":"any","required":true,"defaultValue":"","description":"static void. Fires plugin_scaffold_activated.","values":"","deprecated":false},{"name":"deactivate","type":"any","required":true,"defaultValue":"","description":"static void. Empty. Comment in source: data stays.","values":"","deprecated":false}],"searchable":false,"compact":false} /-->

### `Linchpin\Plugin_Scaffold\Helper\Files`

`final` class.

<!-- wp:docspress/fields {"title":"Files","fields":[{"name":"glob_recursive","type":"array","required":true,"defaultValue":"","description":"glob_recursive( string $pattern, int $flags = 0 ): string[]. glob() that descends into subdirectories. Used by Bootstrap to find controllers.","values":"","deprecated":false}],"searchable":false,"compact":true} /-->

## Actions

<!-- wp:docspress/fields {"title":"do_action hooks","fields":[{"name":"plugin_scaffold_ready","type":"any","required":true,"defaultValue":"","description":"Fires once every controller has registered its hooks. Argument: Bootstrap $bootstrap.","values":"","deprecated":false},{"name":"plugin_scaffold_activated","type":"any","required":true,"defaultValue":"","description":"Fires from Install::activate after activation. No arguments.","values":"","deprecated":false}],"searchable":false,"compact":false} /-->

<!-- wp:docspress/colorful-code {"language":"php","filename":"plugin-scaffold.php","code":"add_action( 'plugins_loaded', 'plugin_scaffold_init' );\n\nregister_activation_hook( __FILE__, [ \\Linchpin\\Plugin_Scaffold\\Controller\\Install::class, 'activate' ] );\nregister_deactivation_hook( __FILE__, [ \\Linchpin\\Plugin_Scaffold\\Controller\\Install::class, 'deactivate' ] );","showLineNumbers":true,"caption":"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](../overlays/blocks.md) page.
