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

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

nextgenthemes/wp-settings
=========================

011PHP

Since Jun 26Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/nextgenthemes/wp-settings)[ Packagist](https://packagist.org/packages/nextgenthemes/wp-settings)[ RSS](/packages/nextgenthemes-wp-settings/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Modern Lightweight WordPress Settings Framework
===============================================

[](#modern-lightweight-wordpress-settings-framework)

Contribution are very welcome in the [ARVE Repo](https://github.com/nextgenthemes/advanced-responsive-video-embedder), also file issues there.

Making use of the WP Interactivity API this Framework helps you create modern settings pages that:

- Create Settings pages for you with minimal effort and boilerplate.
- Automattic buttons to reset setting for each tab separately.
- Simple and minimalistic. All options are saved into a single array.
- Save only the options that differ from the default options. As recommended by a WP Core developer or someone famous in the community (forgot who it was).
- Easy access to default option values.
- Battle tested for many years in [ARVE](https://wordpress.org/plugins/advanced-responsive-video-embedder/).
- Does not reload the page when switching tabs.
- Do not have a save button but instantly save changes with JavaScript as soon as they are made.

This repo also contains some general purpose utility functions that may be useful for plugin development.

Usage
-----

[](#usage)

If you just want to play with some code that works, just fork [TweakMaster](https://github.com/nextgenthemes/tweakmaster) where this package is used.

You need composer and php 7.4+ and automattic/jetpack-autoloader. The Jetpack Autoloader makes it possible that this package is shared between plugins and that the latest version of the package is used.

`composer.json`

```
{
	"name": "your/plugin",
	"type": "wordpress-plugin",
	"require": {
		"php": ">=7.4",
		"nextgenthemes/wp-settings": "@dev",
		"automattic/jetpack-autoloader": "^v5.0.2"
	},
	"config": {
		"allow-plugins": {
			"automattic/jetpack-autoloader": true
		},
		"optimize-autoloader": true
	}
}
```

This code assumes `PLUGIN_FILE` and `PLUGIN_DIR` constants. You can do it differently, what I like to do is.

`plugin-slug.php`

```
