PHPackages                             hungluu/simwp - 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. [Admin Panels](/categories/admin)
4. /
5. hungluu/simwp

AbandonedArchivedLibrary[Admin Panels](/categories/admin)

hungluu/simwp
=============

Help interacting with Wordpress admin dashboard more easily

31PHP

Since Apr 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/hungluu/simwp)[ Packagist](https://packagist.org/packages/hungluu/simwp)[ RSS](/packages/hungluu-simwp/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Simwp
=====

[](#simwp)

This lightweight module is designed to be put inside any of your Wordpress themes or plugins to help interacting with Wordpress admin dashboard more easily.

**NOTE:** For non-composer user, you can download a compiled version at [simwp-compiled](https://github.com/hungluu/simwp-compiled)

```
composer require simwp=dev-master

```

**Table of Contents :**

1. [Build Wordpress setting pages](#build-wordpress-setting-pages)
2. [Work with Wordpress options](#work-with-wordpress-options)
3. [Create Wordpress setting fields in seconds](#create-wordpress-setting-fields-in-seconds)
4. [Work with Wordpress notices](#work-with-wordpress-notices)
5. [Need helps](#need-helps)
6. [FAQ](#faq)
7. [License](#license)

Build Wordpress setting pages
-----------------------------

[](#build-wordpress-setting-pages)

Register your first own `custom menu` that will contain all your setting pages

```
// create an admin holder to hold custom menus
// and provide features like auto translating
Simwp::admin('custom admin')
	->menu('custom menu'); // Create your new menu item
	->page('custom page'); // A menu contains on or many pages
	->append(Section_Simple::class) // Register a Section to be display (1)
	->set('render', 'custom_render_callback') // Or use a custom rendering function
	->link('https://github.com/hungluu/simwp'); // Or simply redirect to another url
```

(1) Sections are managed by Simwp for auto-rendering page contents into setting pages

[![wordpress sections are auto-rendered by Simwp](https://camo.githubusercontent.com/7ce6e00c9501b7d30eeb44750e623916193241ba9674404358bfa660dd0c8f10/68747470733a2f2f692e696d6775722e636f6d2f32596b713247392e706e6767)](https://camo.githubusercontent.com/7ce6e00c9501b7d30eeb44750e623916193241ba9674404358bfa660dd0c8f10/68747470733a2f2f692e696d6775722e636f6d2f32596b713247392e706e6767)

Work with Wordpress options
---------------------------

[](#work-with-wordpress-options)

Instead of coding those lines and much more

```
if(wp_verify_nonce($_POST['_nonce'], 'nonce-name') && current_user_can('manage_options')){
	if(isset($_POST[$key]) {
		if(is_string($_POST[$key])){
			...
```

You can let Simwp handles all the Wordpress `option` for you

```
// Tell Simwp to auto sanitize and update the option for you when user hit enter
// and show error messages when the submitted value is not valid
Simwp::manage('opt-key');

// Check if user submit option value, if so, sanitize it
Simwp::updated('opt-key', $opt_callback);

// Check if user submit option value, and if that value
// is valid with Symfony\Validator, or accessible for current
// section / page
Simwp::handled('opt-key', $opt_callback);

Simwp::is('csrf'); // check if csrf attack presents in admin dashboard, good for ajax options
Simwp::is('dashboard'); // check if current view is admin dashboard
Simwp::is('user'); // check if user logged in

// Some simple option handling
Simwp::option('opt-key')
	->appendTo(Simple_Section::class) // the option updating only available in a specified section
	->appendTo($custom_menu) // or shared with all the pages inside menu
	->appendTo('themes.php') // or shared with an admin-dashboard slug
	->validate(new Assert\NotBlank()) // force option not to be blank
	->validate(new Assert\Email()) // and force it to be an email
	->updated($fn); // Or push a callback to determine when the option is submited, data sanitized before
					// being passed in as an argument
```

[![Wordpress options are validated by Symfony\Validator](https://camo.githubusercontent.com/41a7ead574695909863691a1f158ac3d9ebdb1827f8bb8feb2bc7c974ce3c939/68747470733a2f2f692e696d6775722e636f6d2f456664336644772e706e67)](https://camo.githubusercontent.com/41a7ead574695909863691a1f158ac3d9ebdb1827f8bb8feb2bc7c974ce3c939/68747470733a2f2f692e696d6775722e636f6d2f456664336644772e706e67)

For getting option value

```
Simwp::get('opt-key') // get option value

Simwp::option('opt-key')
	->default('def-value') // default value to return when option not found
	->type('array') // submited value will be parsed as array
	->type('boolean'); // submited value weill be parsed as boolean
```

Create Wordpress setting fields in seconds
------------------------------------------

[](#create-wordpress-setting-fields-in-seconds)

An example code of a `section`

```
class SimpleSection extends Simwp\Section {
	function is_registered(){
		// create a checkbox for 'registered' option
		// short version of $this->view('toggle')->render('registered')
		$this->toggle('registered');
	}

	function user_name(){
		// create an input to fill 'followed-users'
		// short version of $this->view('tags')->render('followed-users')
		$this->tags('followed-users');
	}
}
```

[![Some section components](https://camo.githubusercontent.com/038ec3777046dbb42ff375a549a7d532213153225aae4740936eb328e01aaf6e/68747470733a2f2f692e696d6775722e636f6d2f4a4151524662682e706e67)](https://camo.githubusercontent.com/038ec3777046dbb42ff375a549a7d532213153225aae4740936eb328e01aaf6e/68747470733a2f2f692e696d6775722e636f6d2f4a4151524662682e706e67)

More and more components are being created, current list is default components ( with their own javascript events ) :

- Editor ( TinyMCE )
- Checkboxes
- Color Picker
- Date Picker
- DateTime Picker
- Image ( simwp\_image\_selected, simwp\_image\_removed )
- Input
- Lines ( simwp\_line\_added, simwp\_line\_removed )
- Options
- Radios
- Tags
- Textarea
- Toggle

Work with Wordpress notices
---------------------------

[](#work-with-wordpress-notices)

Create a new `notice` and give it a name

```
Simwp::notice('simple-notice')
	->append('example text');
```

There are 4 types of notice :

- `no-control` notices are interactive
- `dismissible` notices can be hidden by users, but can be shown at next requests
- `removable` notices can be avoided by users at any requests
- `force` notices can never be avoided by users

And 5 flags of notice : `primary` `info` `success` `warning` `error`

[![Notices have 4 types and 4 flags](https://camo.githubusercontent.com/c72fc9243d19b7726b1b3ee29a70d1d8afeafd69c95e4b3fd880ebe10a930692/68747470733a2f2f692e696d6775722e636f6d2f425a7a687667542e706e67)](https://camo.githubusercontent.com/c72fc9243d19b7726b1b3ee29a70d1d8afeafd69c95e4b3fd880ebe10a930692/68747470733a2f2f692e696d6775722e636f6d2f425a7a687667542e706e67)

Need helps
----------

[](#need-helps)

Find resolved issues or create a new one if you can't find any issue related to your problem at [Issues](https://github.com/hungluu/simwp/issues)

FAQ
---

[](#faq)

**How can I create my own section components and filters?**

You can declare you own components and filters at any time, the components should be inside namespace `Simwp\Form` and the filters should be inside namespace `Simwp\Form\Filter` so the default `view` and `filter` method can easily recognize them.

For example, you declare a new component `Simwp\Form\Custom` and inside a `section` you can call this line to render your new custom component :

```
$this->custom('opt-name');
```

License
-------

[](#license)

This module is completely **free** for any projects including commercial ones, and based on **MIT License**. You can do anything with it. The project is in its very early state and need more contributed tests, components, filters, or translations ... so I will appreciate very much if you can join us. Thank you.

Stay tuned.

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 96.8% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c46862d5f35472095e0a07be7b7ab0bd0fb459c5f2bedb211f703573a570826e?d=identicon)[hungluu](/maintainers/hungluu)

---

Top Contributors

[![hungluu](https://avatars.githubusercontent.com/u/13363340?v=4)](https://github.com/hungluu "hungluu (30 commits)")[![dumday](https://avatars.githubusercontent.com/u/142757245?v=4)](https://github.com/dumday "dumday (1 commits)")

---

Tags

adminbuilderdashboardwordpress

### Embed Badge

![Health badge](/badges/hungluu-simwp/health.svg)

```
[![Health](https://phpackages.com/badges/hungluu-simwp/health.svg)](https://phpackages.com/packages/hungluu-simwp)
```

PHPackages © 2026

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