PHPackages                             carawebs/wp-plugin-settings - 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. carawebs/wp-plugin-settings

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

carawebs/wp-plugin-settings
===========================

Generate WordPress plugin settings from a config file.

1.0.4(9y ago)1861GPL2PHP

Since Mar 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Carawebs/wp-plugin-settings)[ Packagist](https://packagist.org/packages/carawebs/wp-plugin-settings)[ RSS](/packages/carawebs-wp-plugin-settings/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (1)

Generate WordPress Settings
===========================

[](#generate-wordpress-settings)

**This package is in development and is not suitable for production yet.**

Configuring plugin settings with the WordPress settings API can be a bit tricky.

It's difficult to keep your code DRY, and the relationship between the different functions can be tricky to set up.

It makes sense to register settings the WordPress way because your code may well have to play nicely with other developers who you're never going to meet. It also has to robust enough to survive future WordPress upgrades.

The downside of this is that you need to manage the relationship between `register_setting()`, `add_settings_field()`, `add_settings_section()`, `add_settings_field()`, `settings_fields()`, `do_settings_sections()` etc...just to output a simple form that saves a value to the WP options table.

This package is a first stab at abstracting the settings setup. You just pass in a config file which returns a PHP array. This is used to configure settings.

Usage
-----

[](#usage)

```
$optionsPageConfig = dirname(__FILE__) . '/options-page-config.php';
$menuPageConfig = dirname(__FILE__) . '/menu-page-settings-config.php';
// Settings Page
$optionsPage = new SettingsController;
$optionsPage->setOptionsPageArgs($optionsPageConfig)->initOptionsPage();
```

TODO
----

[](#todo)

Build a fluent interface so you can add settings pages like:

```
