PHPackages                             solutionbox/wordpress-settings-framework - 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. solutionbox/wordpress-settings-framework

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

solutionbox/wordpress-settings-framework
========================================

1.3.0(2y ago)2331[1 issues](https://github.com/sharazghouri/soution-box-settings/issues)MITPHP

Since Mar 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sharazghouri/soution-box-settings)[ Packagist](https://packagist.org/packages/solutionbox/wordpress-settings-framework)[ RSS](/packages/solutionbox-wordpress-settings-framework/feed)WikiDiscussions main Synced today

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

WordPress Settings Framework
============================

[](#wordpress-settings-framework)

[![Total Downloads](https://camo.githubusercontent.com/94eb9ff39b87194efb564df888da7fb92394574fa4e395cf61b7ca920c441f76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6c7574696f6e626f782f776f726470726573732d73657474696e67732d6672616d65776f726b)](https://packagist.org/packages/solutionbox/wordpress-settings-framework)[![Latest Stable Version](https://camo.githubusercontent.com/14fff919c52fc6fe10f7c7b4b0aba6a4d0aa412eb11b6f722d52fba82fe6499e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6c7574696f6e626f782f776f726470726573732d73657474696e67732d6672616d65776f726b)](https://packagist.org/packages/solutionbox/wordpress-settings-framework)[![License](https://camo.githubusercontent.com/2acc169d702863561458f10bc5de8d3a6602285310af6a2c412e32c2bdeab118/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736f6c7574696f6e626f782f776f726470726573732d73657474696e67732d6672616d65776f726b)](https://packagist.org/packages/solutionbox/wordpress-settings-framework)

The WordPress Settings Framework aims to take the pain out of creating settings pages for your WordPress plugins by effectively creating a wrapper around the WordPress settings API and making it super simple to create and maintain settings pages. This repo is actually a working plugin which demonstrates how to implement SBSA in your plugins. See `src/sbsa-test.php`for details.

You can use this framework with composer if you are using auto loading in your plugin.

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

[](#installation)

```
composer require solutionbox/wordpress-settings-framework
```

Setting Up Your Plugin
----------------------

[](#setting-up-your-plugin)

1. Install the package via composer.
2. Create a "settings" folder in your plugin root.
3. Create a settings file in your new "settings" folder (e.g. `settings-general.php`)

Now you can set up your plugin like:

```
use  Solution_Box_Settings;

class SBSATest {
	/**
	 * @var string
	 */
	private $plugin_path;

	/**
	 * @var WordPressSettingsFramework
	 */
	private $sbsa;

	/**
	 * SBSATest constructor.
	 */
	function __construct() {
		$this->plugin_path = plugin_dir_path( __FILE__ );

		$this->sbsa = new Solution_Box_Settings\SettingsAPI( $this->plugin_path . 'src/settings/example-settings.php', 'my_example_settings' );

		// Add admin menu
		add_action( 'admin_menu', array( $this, 'add_settings_page' ), 20 );

		// Add an optional settings validation filter (recommended)
		add_filter( $this->sbsa->get_option_group() . '_settings_validate', array( &$this, 'validate_settings' ) );
	}

	/**
	 * Add WooCommerce sub settings page.
	 */
	function add_settings_page() {
		$this->sbsa->add_settings_page( array(
			'parent_slug' => 'woocommerce',
			'page_title'  => __( 'Page Title', 'text-domain' ),
			'menu_title'  => __( 'menu Title', 'text-domain' ),
			'capability'  => 'manage_woocommerce',
		) );
	}

	/**
	 * Validate settings.
	 *
	 * @param $input
	 *
	 * @return mixed
	 */
	function validate_settings( $input ) {
		// Do your settings validation here
		// Same as $sanitize_callback from http://codex.wordpress.org/Function_Reference/register_setting
		return $input;
	}

	// ...
}
```

Your settings values can be accessed like so:

```
// Get settings
$this->sbsa->get_settings();
```

This will get either the saved setting values, or the default values that you set in your settings file.

Or by getting individual settings:

```
// Get individual setting
$setting = Solution_Box_Settings\SettingsAPI::get_setting( 'prefix_settings_general', 'general', 'text' );
```

The Settings Files
------------------

[](#the-settings-files)

The settings files work by filling the global `$sbsa_settings` array with data in the following format:

```
$sbsa_settings[] = array(
    'section_id' => 'general', // The section ID (required)
    'section_title' => 'General Settings', // The section title (required)
    'section_description' => 'Some intro description about this section.', // The section description (optional)
    'section_order' => 5, // The order of the section (required)
    'fields' => array(
        array(
            'id' => 'text',
            'title' => 'Text',
            'desc' => 'This is a description.',
            'placeholder' => 'This is a placeholder.',
            'type' => 'text',
            'default' => 'This is the default value'
        ),
        array(
            'id' => 'select',
            'title' => 'Select',
            'desc' => 'This is a description.',
            'type' => 'select',
            'default' => 'green',
            'choices' => array(
                'red' => 'Red',
                'green' => 'Green',
                'blue' => 'Blue'
            )
        ),

        // add as many fields as you need...

    )
);
```

Valid `fields` values are:

- `id` - Field ID
- `title` - Field title
- `desc` - Field description
- `placeholder` - Field placeholder
- `type` - Field type (text/password/textarea/select/radio/checkbox/checkboxes/color/file/editor/code\_editor)
- `default` - Default value (or selected option)
- `choices` - Array of options (for select/radio/checkboxes)
- `mimetype` - Any valid mime type accepted by Code Mirror for syntax highlighting (for code\_editor)

See `settings/example-settings.php` for an example of possible values.

API Details
-----------

[](#api-details)

```
new Solution_Box_Settings\SettingsAPI( string $settings_file [, string $option_group = ''] )

```

Creates a new settings [option\_group](http://codex.wordpress.org/Function_Reference/register_setting) based on a settings file.

- `$settings_file` - path to the settings file
- `$option_group` - optional "option\_group" override (by default this will be set to the basename of the settings file)

```
 Solution_Box_Settings\SettingsAPI::get_setting( $option_group, $section_id, $field_id )
```

Get a setting from an option group

- `$option_group` - option group id.
- `$section_id` - section id (change to `[{$tab_id}_{$section_id}]` when using tabs.
- `$field_id` - field id.

```
Solution_Box_Settings\SettingsAPI::delete_settings( $option_group )
```

Delete all the saved settings from a option group

- `$option_group` - option group id

Actions &amp; Filters
---------------------

[](#actions--filters)

**Filters**

- `sbsa_register_settings_[option_group]` - The filter used to register your settings. See `settings/example-settings.php` for an example.
- `[option_group]_settings_validate` - Basically the `$sanitize_callback` from [register\_setting](http://codex.wordpress.org/Function_Reference/register_setting). Use `$sbsa->get_option_group()` to get the option group id.
- `sbsa_defaults_[option_group]` - Default args for a settings field

**Actions**

- `sbsa_before_settings_page_[option_group]` - Before setting page HTML is output
- `sbsa_after_settings_page_[option_group]` - After setting page HTML is output
- `sbsa_before_settings_page_header_[option_group]` - Before setting page header HTML is output
- `sbsa_after_settings_page_header_[option_group]` - After setting page header HTML is output
- `sbsa_settings_sections_args_[option_group]` - Section extra args for to wrap the section with HTML and extra class [More](https://developer.wordpress.org/reference/functions/add_settings_section/#parameters)
- `sbsa_before_field_[option_group]` - Before a field HTML is output
- `sbsa_before_field_[option_group]_[field_id]` - Before a field HTML is output
- `sbsa_after_field_[option_group]` - After a field HTML is output
- `sbsa_after_field_[option_group]_[field_id]` - After a field HTML is output
- `sbsa_before_settings_[option_group]` - Before settings form HTML is output
- `sbsa_after_settings_[option_group]` - After settings form HTML is output
- `sbsa_before_tabless_settings_[option_group]` - Before settings section HTML is output
- `sbsa_after_tabless_settings_[option_group]` - After settings section HTML is output
- `sbsa_before_settings_fields_[option_group]` - Before settings form fields HTML is output (inside the ``)
- `sbsa_do_settings_sections_[option_group]` - Settings form fields HTMLoutput (inside the ``)
- `sbsa_before_tab_links_[option_group]` - Before tabs HTML is output
- `sbsa_after_tab_links_[option_group]` - After tabs HTML is output

Examples
--------

[](#examples)

**Example 1 Tabless settings**[![image](https://user-images.githubusercontent.com/17900945/227388614-e0bb62c4-f09a-49f9-875f-b37e2d0e9fce.png)](https://user-images.githubusercontent.com/17900945/227388614-e0bb62c4-f09a-49f9-875f-b37e2d0e9fce.png)

**Example 2 Tabbed settings**[![image](https://user-images.githubusercontent.com/17900945/227388843-719a1f93-39f7-4459-afa1-13642c799a31.png)](https://user-images.githubusercontent.com/17900945/227388843-719a1f93-39f7-4459-afa1-13642c799a31.png)

Credits
-------

[](#credits)

The WordPress Settings Framework was Cloned from [iconicwp](https://github.com/iconicwp/WordPress-Settings-Framework) then converted into php package with more features.

Please contribute by [reporting bugs](https://github.com/sharazghouri/soution-box-settings/issues) and submitting [pull requests](https://github.com/sharazghouri/soution-box-settings/pulls).

Want to say thanks? [Consider tipping me](https://www.paypal.me/jamesckemp).

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

Recently: every ~110 days

Total

6

Last Release

756d ago

Major Versions

0.1.0 → 1.0.02024-04-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/6fefb7db9e5c013290d6c846fd31c2148906882005d54137a00af906fb9c2cae?d=identicon)[sharazghouri](/maintainers/sharazghouri)

---

Top Contributors

[![sharazghouri](https://avatars.githubusercontent.com/u/17900945?v=4)](https://github.com/sharazghouri "sharazghouri (28 commits)")

---

Tags

wordpresswordpress-pluginwordpress-settingswordpress-settings-apiwordpress pluginwordpress-settingswordpress-settings-apiwordpess

### Embed Badge

![Health badge](/badges/solutionbox-wordpress-settings-framework/health.svg)

```
[![Health](https://phpackages.com/badges/solutionbox-wordpress-settings-framework/health.svg)](https://phpackages.com/packages/solutionbox-wordpress-settings-framework)
```

###  Alternatives

[log1x/navi

A developer-friendly alternative to the WordPress NavWalker.

370700.3k11](/packages/log1x-navi)[wpmetabox/meta-box

The most powerful &amp; comprehensive plugin to create, manage, show and connect dynamic data with forms and custom fields effortlessly on WordPress.

1.2k20.8k5](/packages/wpmetabox-meta-box)[freemius/wordpress-sdk

Freemius WordPress SDK

307142.4k9](/packages/freemius-wordpress-sdk)[log1x/acf-editor-palette

A replica Gutenberg color picker field for Advanced Custom Fields.

101308.4k](/packages/log1x-acf-editor-palette)[hellonico/acf-country

A country field for ACF.

12196.8k](/packages/hellonico-acf-country)[alleyinteractive/wp-asset-manager

Asset Manager is a toolkit for managing front-end assets and more tightly controlling where, when, and how they're loaded.

32435.5k7](/packages/alleyinteractive-wp-asset-manager)

PHPackages © 2026

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