PHPackages                             ssovit/wp-util - 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. ssovit/wp-util

ActiveLibrary[Admin Panels](/categories/admin)

ssovit/wp-util
==============

Utilities for WordPress

1.0.2(2y ago)017MITPHP

Since Jul 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ssovit/wp-util)[ Packagist](https://packagist.org/packages/ssovit/wp-util)[ Docs](https://github.com/ssovit/wp-util)[ RSS](/packages/ssovit-wp-util/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (4)Used By (0)

WordPress Utilities
===================

[](#wordpress-utilities)

Simple yet powerful utility that I use mostly for my client's projects. This project was built over time so I could re-use them over multiple of my projects.

This project was actually built to have clean admin interface with ability to add tabbed settings page.

[![Admin Settings](assets/admin-preview.jpg)](assets/admin-preview.jpg)

### Admin Settings Builder

[](#admin-settings-builder)

---

```
$admin = new \Sovit\Utilities\Admin_Setting();
$admin->set_page_id("my-setting-page")
        ->set_capability('manage_options')
        ->set_page_title(esc_html__('My Setting'))
        ->set_menu_title(esc_html__('My Setting'))
        ->set_setting_key("my_setting_name")
        ->set_icon('dashicons-admin-links');
```

### Available Methods

[](#available-methods)

---

- `set_page_id($page_id)` - Unique Page ID (if page id is `my-setting-page` then setting page url would be `/wp-admin/admin.php?page=my-setting-page`)
- `set_capability($capability)` - Set capability (eg: `manage_options`)
- `set_menu_title($menu_title)` - Admin menu name
- `set_page_title($page_title)` - Admin setting page title
- `set_icon($icon)` - *(dashicon, icon url)* Menu icon
- `set_setting_key($setting_key)` - Setting name key
- `set_menu_position($menu_position)` - Menu Position
- `set_menu_parent($menu_parent)` - Set menu parent *(eg: `options-general.php` if you want setting page as child of `Settings` page)*

### Available Hooks

[](#available-hooks)

#### `sovit/settings/{$page_id}/tabs` - Register Setting Tab

[](#sovitsettingspage_idtabs---register-setting-tab)

```
add_filter("sovit/settings/{$page_id}/tabs",function($tabs){
    $tabs["my_tab"]=[
        "label"=>__("My Tab","textdomain")
    ];
    return $tabs;
});
```

Tabs also accept `render_callback` if you require custom tab content

```
add_filter("sovit/settings/{$page_id}/tabs",function($tabs){
    $tabs["my_tab"]=[
        "label"=>__("My Tab","textdomain"),
        "render_callback"=>"my_tab_callback"
    ];
    return $tabs;
});
function my_tab_callback(){
    echo "My tab Content";
}
```

#### `sovit/settings/{$page_id}/sections` - Register Setting Section

[](#sovitsettingspage_idsections---register-setting-section)

```
add_filter("sovit/settings/{$page_id}/tabs",function($sections){
    $sections["general"]=[
        "label"=>__("General Settings","textdomain")
    ];
    return $sections;
});
```

Sections also accept `render_callback` if you require custom section content

```
add_filter("sovit/settings/{$page_id}/sections",function($sections){
    $sections["general_setting"]=[
        "label"=>__("General Settings","textdomain"),
        "render_callback"=>"my_section_callback"
    ];
    return $sections;
});
function my_section_callback(){
    echo "My Section Content";
}
```

#### `sovit/settings/{$page_id}/fields` - Register Setting Fields

[](#sovitsettingspage_idfields---register-setting-fields)

```
add_filter("sovit/settings/{$page_id}/fields",function($fields){
    $fields["fruit"]=[
        "label"=>__("Fruit","textdomain"),
        'section' => "general_setting",
        'tab' => "general",
        'type'    => 'select',
        "options" =>  [
            "apple" => __("Apple", "textdomain"),
        ],
        'desc' => esc_html__('Select a fruit', "textdomain"),
        // There are other options based on field types
        // see lib/Controls.php
    ];
    return $fields;
});
```

Fields also accept `render_callback` if you require custom field content

```
add_filter("sovit/settings/{$page_id}/fields",function($sections){
    $fields["fruit"]=[
        "label"=>__("Fruit","textdomain"),
        "render_callback"=>"my_custom_field",
        // .. other field data
    ];
    return $fields;
});
function my_custom_field($field=array()){
    echo "".print_r($field,true).""; // print field data
}
```

#### Field validation and sanitization

[](#field-validation-and-sanitization)

```
add_filter("sovit/settings/{$page_id}/fields",function($sections){
    $fields["age"]=[
        "label"=>__("Age","textdomain"),
        "render_callback"=>"my_custom_field",
        "validate_callback"=>"my_field_validation",
        "sanitize_callback"=>"my_field_sanitization",
        // other field options
    ];
    return $fields;
});
function validate_callback($value){
    return is_int($value) && $value>5; // return true if age is integer and greater than 5
}
function sanitize_callback($value){
    return sanitize_text_field($value);
}
```

### Work In Progress

[](#work-in-progress)

This project is work in progress but is usable as is. There are more features, but not yet documented.

### Want to contribute

[](#want-to-contribute)

If you want to contribute, create pull request.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

3

Last Release

1091d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3162122?v=4)[Sovit Tamrakar](/maintainers/ssovit)[@ssovit](https://github.com/ssovit)

---

Top Contributors

[![ssovit](https://avatars.githubusercontent.com/u/3162122?v=4)](https://github.com/ssovit "ssovit (14 commits)")

---

Tags

pluginwordpressthemeadminutilities

### Embed Badge

![Health badge](/badges/ssovit-wp-util/health.svg)

```
[![Health](https://phpackages.com/badges/ssovit-wp-util/health.svg)](https://phpackages.com/packages/ssovit-wp-util)
```

PHPackages © 2026

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