PHPackages                             eighteen73/settings-api - 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. eighteen73/settings-api

ActiveLibrary

eighteen73/settings-api
=======================

A helper class for registering WordPress settings pages with a simpler API.

V1.2.0(2y ago)39761MITPHPPHP &gt;=7.4

Since Nov 24Pushed 2y ago5 watchersCompare

[ Source](https://github.com/eighteen73/settings-api)[ Packagist](https://packagist.org/packages/eighteen73/settings-api)[ RSS](/packages/eighteen73-settings-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

WordPress Settings API Class
============================

[](#wordpress-settings-api-class)

Allows for easier creation of plugin settings pages by using an object orianted approach, with an API similar to the customizer.

An example
----------

[](#an-example)

```
use Eighteen73\SettingsApi\SettingsApi;

$settings = new SettingsApi(
	'Plugin Settings',
	'Plugin Settings',
	'manage_options',
	'plugin-name',
	100,
	false, // set it to 'true' to create a top level menu
	''     // icon url to be used on top level menu
);

// Submenus: if top level menu is created.
$settings->set_submenu(
	'Submenu 1',
	'Submenu 1',
	'plugin-name-submenu',
	[ $this, 'callback_function' ]
);

// Section: Basic Settings.
$settings->add_section(
	[
		'id'    => 'plugin_name_basic',
		'title' => __( 'Basic Settings', 'plugin-name' ),
	]
);

// Section: Other Settings.
$settings->add_section(
	[
		'id'    => 'plugin_name_other',
		'title' => __( 'Other Settings', 'plugin-name' ),
	]
);

// Field: Text.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'      => 'text',
		'type'    => 'text',
		'name'    => __( 'Text Input', 'plugin-name' ),
		'desc'    => __( 'Text input description', 'plugin-name' ),
		'default' => 'Default Text',
	]
);

// Field: Number.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'                => 'text_no',
		'type'              => 'number',
		'name'              => __( 'Number Input', 'plugin-name' ),
		'desc'              => __( 'Number field with validation callback `intval`', 'plugin-name' ),
		'default'           => 1,
		'sanitize_callback' => 'intval',
	]
);

// Field: Email.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'   => 'email',
		'type' => 'email',
		'name' => __( 'Email', 'plugin-name' ),
		'desc' => __( 'Email field description', 'plugin-name' ),
	]
);

// Field: Password.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'   => 'password',
		'type' => 'password',
		'name' => __( 'Password Input', 'plugin-name' ),
		'desc' => __( 'Password field description', 'plugin-name' ),
	]
);

// Field: Textarea.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'   => 'textarea',
		'type' => 'textarea',
		'name' => __( 'Textarea Input', 'plugin-name' ),
		'desc' => __( 'Textarea description', 'plugin-name' ),
	]
);

// Field: Separator.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'   => 'separator',
		'type' => 'separator',
	]
);

// Field: Title.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'   => 'title',
		'type' => 'title',
		'name' => 'Title',
	]
);

// Field: Checkbox.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'   => 'checkbox',
		'type' => 'checkbox',
		'name' => __( 'Checkbox', 'plugin-name' ),
		'desc' => __( 'Checkbox Label', 'plugin-name' ),
	]
);

// Field: Radio.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'      => 'radio',
		'type'    => 'radio',
		'name'    => __( 'Radio', 'plugin-name' ),
		'desc'    => __( 'Radio Button', 'plugin-name' ),
		'options' => [
			'yes' => 'Yes',
			'no'  => 'No',
		],
	]
);

// Field: Multicheck.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'      => 'multicheck',
		'type'    => 'multicheck',
		'name'    => __( 'Multile checkbox', 'plugin-name' ),
		'desc'    => __( 'Multile checkbox description', 'plugin-name' ),
		'options' => [
			'yes' => 'Yes',
			'no'  => 'No',
		],
	]
);

// Field: Multicheck with descriptions.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'      => 'multicheck_descriptions',
		'type'    => 'multicheck',
		'name'    => __( 'Multile checkbox with descriptions', 'plugin-name' ),
		'desc'    => __( 'Multile checkbox description', 'plugin-name' ),
		'options' => [
			'yes' => [
				'label' => 'Yes',
				'desc'  => 'Description of option',
			],
			'no' => [
				'label' => 'No',
				'desc'  => 'Description of option',
			],
		],
	]
);

// Field: Select.
$settings->add_field(
	'plugin_name_basic',
	[
		'id'      => 'select',
		'type'    => 'select',
		'name'    => __( 'A Dropdown', 'plugin-name' ),
		'desc'    => __( 'A Dropdown description', 'plugin-name' ),
		'options' => [
			'yes' => 'Yes',
			'no'  => 'No',
		],
	]
);

// Field: Image.
$settings->add_field(
	'plugin_name_other',
	[
		'id'      => 'image',
		'type'    => 'image',
		'name'    => __( 'Image', 'plugin-name' ),
		'desc'    => __( 'Image description', 'plugin-name' ),
		'options' => [
			'button_label' => 'Choose Image',
		],
	]
);

// Field: File.
$settings->add_field(
	'plugin_name_other',
	[
		'id'      => 'file',
		'type'    => 'file',
		'name'    => __( 'File', 'plugin-name' ),
		'desc'    => __( 'File description', 'plugin-name' ),
		'options' => [
			'button_label' => 'Choose file',
		],
	]
);

// Field: Color.
$settings->add_field(
	'plugin_name_other',
	[
		'id'          => 'color',
		'type'        => 'color',
		'name'        => __( 'Color', 'plugin-name' ),
		'desc'        => __( 'Color description', 'plugin-name' ),
		'placeholder' => __( '#5F4B8B', 'plugin-name' ),
	]
);

// Field: WYSIWYG.
$settings->add_field(
	'plugin_name_other',
	[
		'id'   => 'wysiwyg',
		'type' => 'wysiwyg',
		'name' => __( 'WP_Editor', 'plugin-name' ),
		'desc' => __( 'WP_Editor description', 'plugin-name' ),
	]
);
```

Credits
-------

[](#credits)

Heavily based on [WP-OOP-Settings-API](https://github.com/ahmadawais/WP-OOP-Settings-API) by Ahmad Awais.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.2% 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 ~59 days

Recently: every ~74 days

Total

6

Last Release

972d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/892c0716ab606189211e31c70047104e48067d22fc385770b193d89e8a056164?d=identicon)[brettsmason](/maintainers/brettsmason)

---

Top Contributors

[![brettsmason](https://avatars.githubusercontent.com/u/73229?v=4)](https://github.com/brettsmason "brettsmason (13 commits)")[![alexmigf](https://avatars.githubusercontent.com/u/533273?v=4)](https://github.com/alexmigf "alexmigf (5 commits)")

---

Tags

settings-apiwordpress

### Embed Badge

![Health badge](/badges/eighteen73-settings-api/health.svg)

```
[![Health](https://phpackages.com/badges/eighteen73-settings-api/health.svg)](https://phpackages.com/packages/eighteen73-settings-api)
```

PHPackages © 2026

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