PHPackages                             underpin/widget-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. underpin/widget-loader

ActiveLibrary

underpin/widget-loader
======================

Widget loader for Underpin

1.1.0(4y ago)01041GPL-2.0-or-laterPHP

Since May 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Underpin-WP/widget-loader)[ Packagist](https://packagist.org/packages/underpin/widget-loader)[ RSS](/packages/underpin-widget-loader/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (1)Versions (8)Used By (0)

Underpin Widget Loader
======================

[](#underpin-widget-loader)

Loader That assists with adding widgets to a WordPress website. It uses Underpin's built-in fields API to handle the render, and storage of widget data

Installation
------------

[](#installation)

### Using Composer

[](#using-composer)

`composer require underpin/widget-loader`

### Manually

[](#manually)

This plugin uses a built-in autoloader, so as long as it is required *before*Underpin, it should work as-expected.

`require_once(__DIR__ . '/underpin-widgets/index.php');`

Setup
-----

[](#setup)

1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)
2. Register new widgets menus as-needed.

Example
-------

[](#example)

A very basic example could look something like this.

```
// Register widget
underpin()->widgets()->add( 'hello-world-widget', [
	'name'                => underpin()->__( 'Hello World Widget' ),                               // Required. The name of the widget.
	'id_base'             => 'widget_name',                                                        // Required. The ID.
	'description'         => underpin()->__( 'Displays hello to a specified name on your site.' ), // Widget description.
	'widget_options'      => [                                                                     // Options to pass to widget. See wp_register_sidebar_widget
		'classname' => 'test_widget',
	],
	'get_fields_callback' => function ( $fields, \WP_Widget $widget ) {                            // Fetch, and set settings fields.
		$name = isset( $fields['name'] ) ? esc_html( $fields['name'] ) : 'world';

		return [
			new \Underpin\Factories\Settings_Fields\Text( $name, [
				'name'        => $widget->get_field_name( 'name' ), // See WP_Widget get_field_name
				'id'          => $widget->get_field_id( 'name' ),   // See WP_Widget get_field_id
				'setting_key' => 'name',                            // Must match field name and field ID
				'description' => underpin()->__( 'Optional. Specify the person to say hello to. Default "world".' ),
				'label'       => underpin()->__( 'Name' ),
			] ),
		];
	},
	'display_callback'    => function ( $instance, $fields ) {                                      // Render output
		$name = ! empty( $fields['name'] ) ? esc_html( $fields['name'] ) : 'world';

		echo underpin()->__( sprintf( 'Hello, %s!', $name ) );
	},
] );
```

Alternatively, you can extend `Widget` and reference the extended class directly, like so:

```
underpin()->widgets()->add('widget-key','Namespace\To\Class');
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~67 days

Total

4

Last Release

1637d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e6206223bd6f2a57b8ac80605b1b5c3521faaec18ad3f20f25fb728a9a13784?d=identicon)[tstandiford](/maintainers/tstandiford)

---

Top Contributors

[![alexstandiford](https://avatars.githubusercontent.com/u/8210827?v=4)](https://github.com/alexstandiford "alexstandiford (20 commits)")

---

Tags

underpinwidgetwordpress

### Embed Badge

![Health badge](/badges/underpin-widget-loader/health.svg)

```
[![Health](https://phpackages.com/badges/underpin-widget-loader/health.svg)](https://phpackages.com/packages/underpin-widget-loader)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
