PHPackages                             askupa-software/amarkal-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. askupa-software/amarkal-settings

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

askupa-software/amarkal-settings
================================

Add setting pages with Amarkal UI components to your WordPress theme or plugin

5361PHP

Since Dec 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/amarkal/amarkal-settings)[ Packagist](https://packagist.org/packages/askupa-software/amarkal-settings)[ RSS](/packages/askupa-software-amarkal-settings/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

amarkal-settings [![Build Status](https://camo.githubusercontent.com/500b0853e8cb8e04c0e9d0f0dc17323743644084de2d779ee6a9aac4a121efb9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616d61726b616c2f616d61726b616c2d73657474696e67732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/amarkal/amarkal-settings/build-status/master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/a15f7edb8a7cda14fb3670c2809fb268148d942575a91d51f77ad2210c5469da/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616d61726b616c2f616d61726b616c2d73657474696e67732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/amarkal/amarkal-settings/?branch=master) [![Built with Grunt](https://camo.githubusercontent.com/9f156fc8bad420a6d57fa5f6458f87315ac9605ddabdd4c6610a743f144ee254/68747470733a2f2f63646e2e6772756e746a732e636f6d2f6275696c74776974682e737667)](https://gruntjs.com/) [![Amarkal Powered](https://camo.githubusercontent.com/31ea66e0bd17a597b2a0d828a8b37518d813c3bb82a7064633355607c7c55833/68747470733a2f2f61736b757061736f6674776172652e636f6d2f616d61726b616c2d706f77657265642e737667)](https://products.askupasoftware.com/amarkal) [![License](https://camo.githubusercontent.com/d188773d1e42345ca962ea6fc380b95718673e52fe59160bc38e5889034e3289/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d2d332e302532422d7265642e737667)](https://raw.githubusercontent.com/amarkal/amarkal-settings/master/LICENSE)
=======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#amarkal-settings-----)

Add setting pages with [amarkal-ui](https://github.com/amarkal/amarkal-ui) components to your WordPress theme or plugin.

**Tested up to:** WordPress 4.8
**Dependencies**: *[amarkal-core](https://github.com/amarkal/amarkal-core)*, *[amarkal-ui](https://github.com/amarkal/amarkal-ui)*

[![amarkal-settings](https://camo.githubusercontent.com/aea702a3357f8b86e35249c380f370168663f00212d9cfe1d538006ee8b04867/68747470733a2f2f61736b757061736f6674776172652e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30342f616d61726b616c2d73657474696e67732e706e67)](https://camo.githubusercontent.com/aea702a3357f8b86e35249c380f370168663f00212d9cfe1d538006ee8b04867/68747470733a2f2f61736b757061736f6674776172652e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30342f616d61726b616c2d73657474696e67732e706e67)

overview
--------

[](#overview)

**amarkal-settings** lets you create setting pages for your theme or plugin, based on [amarkal-ui](https://github.com/amarkal/amarkal-ui) components. Setting pages store data as options in the database, and use AJAX to store the data asynchronously to improve user experience.

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

[](#installation)

### Via Composer

[](#via-composer)

If you are using the command line:

```
$ composer require askupa-software/amarkal-settings:dev-master

```

Or simply add the following to your `composer.json` file:

```
"require": {
     "askupa-software/amarkal-settings": "dev-master"
 }
```

And run the command

```
$ composer install

```

This will install the package in the directory `vendors/askupa-software/amarkal-settings`.
Now all you need to do is include the composer autoloader.

```
require_once 'path/to/vendor/autoload.php';
```

### Manually

[](#manually)

Download [amarkal-core](https://github.com/amarkal/amarkal-core/archive/master.zip), [amarkal-ui](https://github.com/amarkal/amarkal-ui/archive/master.zip) and [amarkal-settings](https://github.com/amarkal/amarkal-settings/archive/master.zip) from github and include them in your project.

```
require_once 'path/to/amarkal-core/bootstrap.php';
require_once 'path/to/amarkal-ui/bootstrap.php';
require_once 'path/to/amarkal-settings/bootstrap.php';
```

Adding Setting Pages
--------------------

[](#adding-setting-pages)

A Setting page is a graphical user interface (based on amarkal-ui) that provides a convenient way for your users to store and retrieve options for your theme/plugin. A setting page is presented in the admin menu as a child page to an existing top level menu item.

### Adding a settings page

[](#adding-a-settings-page)

The following example shows how to add settings page that will be available under the 'Tools' submenu.

```
$page = amarkal_add_settings_page(array(
    'slug'         => 'my-settings-page',
    'parent_slug'  => 'tools.php', // The 'Tools' top level menu item slug
    'title'        => 'My Settings',
    'menu_title'   => 'My Settings'
));
```

Now you can use the returned instance to add settings fields. Any Amarkal UI component can be used as a field.

```
$page->add_field(array(
    'type'       => 'text',
    'default'    => 'Default text...',
    'title'      => 'My Text',
    'name'       => 'my-text'
));
```

### Adding a section to a settings page

[](#adding-a-section-to-a-settings-page)

You can also divide your settings into sections, to better organize them and make it easier for the user to find what he is looking for.

> > When you add one or more sections, a sidebar will appear with all the added section names, as well as a search box to search for a settings field in all the sections.

```
$page->add_section(array(
    'slug'         => 'my-section', // Must be unique within the list of sections for this page
    'title'        => 'My Section'
));

// Make sure to add a 'section' argument to fields to associate them with a given section
$page->add_field(array(
    'section'    => 'my-section',
    'type'       => 'text',
    'default'    => 'Default text...',
    'title'      => 'My Text',
    'name'       => 'my-text'
));
```

### Retrieving a settings field value

[](#retrieving-a-settings-field-value)

You can retrieve the value of a certain field by its name, and the slug of the page in which it is registered.

> > This method checks the database first, and if nothing is found, it will return the field's default value.

```
$value = amarkal_get_settings_value('my-settings-page', 'my-text');
```

Reference
---------

[](#reference)

### amarkal\_add\_settings\_page

[](#amarkal_add_settings_page)

*Add a settings page.*

```
amarkal_add_settings_page( $args )
```

This function is used to create a settings page in WordPresss admin section. Once created, a menu item will be added to the submenu of the parent slug given in `'parent_slug'`.

> > If you want to create a top-level settings page, you need to create a menu page using `add_menu_page()`, and then set the settings page's `'parent_slug'` to the slug of the top-level menu page that you've created.

**Parameters**

- `$args` (*Array*) The list of page arguments. Acceptable arguments are:
    - `parent_slug` (*String*) The slug name for the parent menu (or the file name of a standard WordPress admin page).
    - `slug` (*String*) The slug name to refer to this menu by (should be unique for this menu).
    - `title` (*String*) The text to be displayed in the title tags of the page when it is displayed.
    - `subtitle` (*String*) The text to be displayed below the title at the top part of the page.
    - `menu_title` (*String*) The text to be used for the menu.
    - `capability` (*String*) The capability required for this menu to be displayed to the user. Used to determine whether or not a page is included in the menu.
    - `footer_html` (*String*) Specifies the HTML to be printed at the footer of the settings page.
    - `subfooter_html` (*String*) Specifies the HTML to be printed below footer of the settings page.

**Return Value**
(*Amarkal\\Settings\\SettingsPag*) The instance of the settings page

**Example Usage**

```
amarkal_add_settings_page(array(
    'parent_slug'  => 'tools.php',
    'slug'         => 'my-settings-page',
    'title'        => 'My Settings',
    'menu_title'   => 'My Settings',
    'capability'   => 'manage_options'
));
```

### amarkal\_get\_settings\_page

[](#amarkal_get_settings_page)

*Get the instance of a settings page.*

```
amarkal_get_settings_page( $slug )
```

This function is used to get the instance of a reigstered settings page by its slug.

**Parameters**

- `slug` (*String*) The slug name of the settings page

**Return Value**
(*Amarkal\\Settings\\SettingsPage*) The instance of the settings page

**Example Usage**

```
$page = amarkal_get_settings_page('my-settings-page');
```

### amarkal\_get\_settings\_value

[](#amarkal_get_settings_value)

*Get the value of the given field.*

```
amarkal_get_settings_value( $slug, $field_name )
```

This function is used to retrieve the value of a given field. If no value exists in the database, the default value will be returned. This function makes a call to `get_option()` internally, providing the default value of the field as the second argument.

**Parameters**

- `$slug` (*String*) The slug of the settings page to which this field belongs
- `$field_name` (*String*) The name of the field.

**Return Value**
(*Mixed*) The value of the given field.

**Example Usage**

```
$value = amarkal_get_settings_value('my-settings','my-text');
```

### amarkal\_get\_settings\_values

[](#amarkal_get_settings_values)

*Get all the values for the given settings page as an array.*

```
amarkal_get_settings_values( $slug )
```

This function is used to retrieve all the value of a given settings page. If no value exists in the database, the default values will be returned. This function makes a call to `get_option()` internally, providing the default value of the field as the second argument.

**Parameters**

- `$slug` (*String*) The slug of the settings page of which the values are to be retrieved.

**Return Value**
(*Array*) The list of all field values

**Example Usage**

```
$values = amarkal_get_settings_values('my-settings');
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/968f78380ddac9ca295244f1cd8d53e3abfe572a0a7351e9bc1b7fc2f85e6bfe?d=identicon)[askupasoftware](/maintainers/askupasoftware)

---

Top Contributors

[![ykadosh](https://avatars.githubusercontent.com/u/7763083?v=4)](https://github.com/ykadosh "ykadosh (51 commits)")

---

Tags

amarkalwordpresswordpress-framework

### Embed Badge

![Health badge](/badges/askupa-software-amarkal-settings/health.svg)

```
[![Health](https://phpackages.com/badges/askupa-software-amarkal-settings/health.svg)](https://phpackages.com/packages/askupa-software-amarkal-settings)
```

PHPackages © 2026

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