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

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

askupa-software/amarkal-widget
==============================

Develop WordPress widgets based on Amarkal UI

3271PHP

Since Dec 25Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

amarkal-widget [![Build Status](https://camo.githubusercontent.com/416bb43219829bc62d4cf1c981fb8fea490b05bfe2e00c07276cab2eba1a06b9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616d61726b616c2f616d61726b616c2d7769646765742f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/amarkal/amarkal-widget/build-status/master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/63cc71af0b3e007b8c0d51e1b2eafe660c43961bd116e2491eac227eb9c0ed34/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616d61726b616c2f616d61726b616c2d7769646765742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/amarkal/amarkal-widget/?branch=master) [![License](https://camo.githubusercontent.com/d188773d1e42345ca962ea6fc380b95718673e52fe59160bc38e5889034e3289/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d2d332e302532422d7265642e737667)](https://raw.githubusercontent.com/amarkal/amarkal-widget/master/LICENSE)
=======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#amarkal-widget---)

Develop WordPress widgets based on Amarkal UI.

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

[![amarkal-widget](https://camo.githubusercontent.com/334ae790019b84261d3ab3b0efa46fe307c088eee158bd4a7264685e4124151c/68747470733a2f2f61736b757061736f6674776172652e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30342f616d61726b616c2d7769646765742e706e67)](https://camo.githubusercontent.com/334ae790019b84261d3ab3b0efa46fe307c088eee158bd4a7264685e4124151c/68747470733a2f2f61736b757061736f6674776172652e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30342f616d61726b616c2d7769646765742e706e67)

Overview
--------

[](#overview)

**amarkal-widget** lets you develop widgets for your WordPress theme or plugin, using [amarkal-ui](https://github.com/amarkal/amarkal-ui). **amarkal-widget** takes care of building the admin user form and saving the user input, so you can concentrate on building the widget itself!

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

[](#installation)

### Via Composer

[](#via-composer)

If you are using the command line:

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

```

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

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

And run the command

```
$ composer install

```

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

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

### Manually

[](#manually)

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

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

Usage
-----

[](#usage)

Create a class that inherits from `\Amarkal\Widget\AbstractWidget`. This class should implement 2 methods:

- `config()` - a public function that returns an array with the widget's configuration.
- `widget( $args, $instance )` - a public function that prints the widget's front-end HTML.

### Configuration Arguments

[](#configuration-arguments)

NameTypeDefaultRequiredDescription`id`*string*`''`YesSpecifies the widget's id.`name`*string*`''`YesSpecifies the widget's name.`widget_options`*array*`array()`NoSpecifies a list of widget options, like a description.`control_options`*array*`array()`NoSpecifies a list of widget control options.`fields`*array*`array()`NoSpecifies a list of `amarkal-ui` components to be used for the widget's admin form. Each item in this array should be an array and have the original UI component arguments as specified in `amarkal-ui`, as well as the following: `default`, `title`, `description`.### Example Code

[](#example-code)

Create a class for your widget:

```
class MyCoolWidget
extends \Amarkal\Widget\AbstractWidget
{
    /**
     * The widget's configuration
     */
    public function config()
    {
        return array(
            'id'              => 'm-cool-widget',   // The widget's id
            'name'            => 'My Cool Widget',  // The widget's id
            'widget_options'  => array(
                'description' => 'Just a very very cool widget...'  // The widget's description
            ),
            'control_options' => array(),           // Optional

            /**
             * The 'fields' argument specifies a list of amarkal-ui components to be used for the widget's admin form.
             */
            'fields'          => array(
                array(
                    'name'          => 'title',
                    'title'         => __( 'Title:', 'slug' ),
                    'default'       => 'My Cool Widget',
                    'description'   => 'Specifies the widget\'s title',
                    'type'          => 'text'
                ),
                array(
                    'name'          => 'content',
                    'title'         => __( 'Text:', 'slug' ),
                    'default'       => 'My cool widget content',
                    'description'   => 'Specifies the widget\'s content',
                    'type'          => 'text'
                ),
            )
        );
    }

    /**
     * The front-end display of widget. User data is accesible through the $instance variable.
     */
    public function widget( $args, $instance )
    {
        $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );

        echo $args['before_widget'];

        // Echo the widget's title if not empty
        if ( $title ) {
            echo $args['before_title'] . $title . $args['after_title'];
        }

        // Echo the widget's content if not empty
        if( $instance['content'] ) {
            echo ''.$instance['content'].'';
        }

        echo $args['after_widget'];
    }
}
```

Then register the widget as you would register any other widget:

```
function register_widgets() {
    register_widget( 'MyCoolWidget' );
}
add_action( 'widgets_init', 'register_widgets' );
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

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 (12 commits)")

---

Tags

amarkalwodpresswordpress-framework

### Embed Badge

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

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

###  Alternatives

[badcow/phrase-generator

Generate an English adjective-noun pair as a phrase (e.g. SubmissiveMonkey).

147.0k](/packages/badcow-phrase-generator)

PHPackages © 2026

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