PHPackages                             luizbills/wp-options-page - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. luizbills/wp-options-page

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

luizbills/wp-options-page
=========================

Easy way to build options/settings pages in your WordPress plugins and themes.

0.8.0(1y ago)267482[3 issues](https://github.com/luizbills/wp-options-page/issues)GPL-2.0-or-laterPHPPHP &gt;=7.4CI passing

Since Jan 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/luizbills/wp-options-page)[ Packagist](https://packagist.org/packages/luizbills/wp-options-page)[ Docs](https://github.com/luizbills/wp-options-page)[ Fund](https://www.luizpb.com/donate/)[ RSS](/packages/luizbills-wp-options-page/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (2)Versions (20)Used By (0)

WP Options Page
===============

[](#wp-options-page)

A class to build options pages for your WordPress plugins and themes.

Install
-------

[](#install)

Install using composer:

```
composer require luizbills/wp-options-page

```

Getting Started
---------------

[](#getting-started)

Just create an `WP_Options_Page` class instance on `init` action hook:

```
function yourprefix_create_settings_page () {
	$page = new WP_Options_Page();

	// give your page a ID
	$page->id = 'my_settings_page';

	// set the menu name
	$page->menu_title = 'My Settings';

	// register your options fields
	$page->fields = [
		// a simple text input field
		[
			'id' => 'api_key',
			'title' => 'API Key',
			'type' => 'text',
		]
	];

	// register the page
	$page->init();

	// access the stored options
	$api_key = $page->get_option( 'api_key' );

	// store this page in a global object or variable
	// So you can easily your instance class later
	// example: My_Plugin->settings = $page;
}
add_action( 'init', 'yourprefix_create_settings_page' );
```

Or create your own derived class:

```
class My_Settings_Page extends WP_Options_Page {
	// I recommend using Singleton pattern
	// So you can easily retrieve the class later
	// example: My_Settings_Page::instance()->get_option( 'api_key' );
	private static $instance = null;
	public static function instance () {
		if ( ! self::$instance ) self::$instance = new self();
		return self::$instance;
	}

	private function __construct () {
		add_action( 'init', [ $this, 'init' ] );
	}

	// overrides the `init` method to setup your page
	public function init () {
		// give your page a ID
		$this->id = 'my_settings_page';

		// set the menu name
		$this->menu_title = 'My Settings';

		// register the page
		parent::init();
	}

	// overrides the `get_fields` method to register your fields
	public function get_fields () {
		return [
			[
				'id' => 'api_key',
				'title' => 'API Key',
				'type' => 'text',
			]
		];
	}
}

// start your class
My_Settings_Page::instance();
```

Preview:

[![](https://user-images.githubusercontent.com/1798830/215272911-9a90f0fd-d62d-49f4-bc64-7906f513695a.png)](https://user-images.githubusercontent.com/1798830/215272911-9a90f0fd-d62d-49f4-bc64-7906f513695a.png)

Learn More
----------

[](#learn-more)

Visit our [wiki](https://github.com/luizbills/wp-options-page/wiki) or study (and install) our [Demo Plugin](https://github.com/luizbills/wp-options-page-demo).

LICENSE
-------

[](#license)

GPLv2 or later

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance44

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

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 ~49 days

Recently: every ~197 days

Total

18

Last Release

406d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1798830?v=4)[Luiz Bills](/maintainers/luizbills)[@luizbills](https://github.com/luizbills)

---

Top Contributors

[![luizbills](https://avatars.githubusercontent.com/u/1798830?v=4)](https://github.com/luizbills "luizbills (102 commits)")

---

Tags

wordpresswordpress-developmentwordpress-pluginwordpressSettingsoptionslibrary

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/luizbills-wp-options-page/health.svg)

```
[![Health](https://phpackages.com/badges/luizbills-wp-options-page/health.svg)](https://phpackages.com/packages/luizbills-wp-options-page)
```

###  Alternatives

[maiorano84/shortcodes

Implement Shortcode syntax anywhere

7664.2k5](/packages/maiorano84-shortcodes)[graste/params

Array wrapper that eases the retrieval of values. Has parameters, options and settings and traits for inclusion in other libraries.

107.0k](/packages/graste-params)

PHPackages © 2026

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