PHPackages                             pinkcrab/perique-admin-menu - 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. pinkcrab/perique-admin-menu

ActiveLibrary[Admin Panels](/categories/admin)

pinkcrab/perique-admin-menu
===========================

The PinkCrab framework package for creating admin pages/groups using inheritance very easyly from plugins and themes.

2.1.1(1mo ago)13.3k[3 PRs](https://github.com/Pink-Crab/Perique_Admin_Menu/pulls)1MITPHPPHP &gt;=8.0.0CI passing

Since Aug 7Pushed 1mo agoCompare

[ Source](https://github.com/Pink-Crab/Perique_Admin_Menu)[ Packagist](https://packagist.org/packages/pinkcrab/perique-admin-menu)[ Docs](https://pinkcrab.co.uk)[ RSS](/packages/pinkcrab-perique-admin-menu/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (32)Versions (39)Used By (1)

[![logo](./docs/Perique%20Admin%20MenuCard.jpg "PinkCrab Perique Hook Subscriber")](./docs/Perique%20Admin%20MenuCard.jpg)

Perique Admin Menu
==================

[](#perique-admin-menu)

A module for the Perique Plugin Framework, for rendering and processing Admin Menu Pages with WordPress

[![Latest Stable Version](https://camo.githubusercontent.com/003d4649fe377d015cb1a4b27defcfb30e5c7ac756d73fea211bd4a6aaf0c220/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f706572697175652d61646d696e2d6d656e752f76)](https://packagist.org/packages/pinkcrab/perique-admin-menu)[![Total Downloads](https://camo.githubusercontent.com/791fa553257cdad81197cd54358d1113d61c97cb4528389be9cd0297df36a389/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f706572697175652d61646d696e2d6d656e752f646f776e6c6f616473)](https://packagist.org/packages/pinkcrab/perique-admin-menu)[![License](https://camo.githubusercontent.com/7dd8b0c8bc77b24b5f0ea9720f06bbae95a75ef96f3f4ba8e0516280663004db/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f706572697175652d61646d696e2d6d656e752f6c6963656e7365)](https://packagist.org/packages/pinkcrab/perique-admin-menu)[![PHP Version Require](https://camo.githubusercontent.com/5145a747be9e898a4713048abf4fa29146c3c4af03ab1df47a140be27a8f1cb1/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f706572697175652d61646d696e2d6d656e752f726571756972652f706870)](https://packagist.org/packages/pinkcrab/perique-admin-menu)[![GitHub contributors](https://camo.githubusercontent.com/8f98ada3d3beca6630b8c44069a38e1445eba3108d0f6c80fffed3a2f4a0994a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f506572697175655f41646d696e5f4d656e753f6c6162656c3d436f6e7472696275746f7273)](https://camo.githubusercontent.com/8f98ada3d3beca6630b8c44069a38e1445eba3108d0f6c80fffed3a2f4a0994a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f506572697175655f41646d696e5f4d656e753f6c6162656c3d436f6e7472696275746f7273)[![GitHub issues](https://camo.githubusercontent.com/f0c8faedd1d92b77830dde15bbb8f50f37bcf1f4243f1a02fec8f751f1d5448a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f506572697175655f41646d696e5f4d656e75)](https://camo.githubusercontent.com/f0c8faedd1d92b77830dde15bbb8f50f37bcf1f4243f1a02fec8f751f1d5448a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f506572697175655f41646d696e5f4d656e75)

[![WP6.6 [PHP8.0-8.4] Tests](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_6.yaml/badge.svg)](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_6.yaml)[![WP6.7 [PHP8.0-8.4] Tests](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_7.yaml/badge.svg)](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_7.yaml)[![WP6.8 [PHP8.0-8.4] Tests](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_8.yaml/badge.svg)](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_8.yaml)[![WP6.9 [PHP8.0-8.4] Tests](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_9.yaml/badge.svg)](https://github.com/Pink-Crab/Perique_Admin_Menu/actions/workflows/WP_6_9.yaml)

[![codecov](https://camo.githubusercontent.com/803a0d41a26a7760d83ea2fa9dde051615024d3cf74c9f45866d0a8f2defa6d3/68747470733a2f2f636f6465636f762e696f2f67682f50696e6b2d437261622f506572697175655f41646d696e5f4d656e752f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Pink-Crab/Perique_Admin_Menu)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7c4b0c20cac2f9599749d7c9fdf29af6b9e7e4ead9a39495eee19ebfaba8d1ba/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f50696e6b2d437261622f506572697175655f41646d696e5f4d656e752f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Pink-Crab/Perique_Admin_Menu/?branch=master)[![Maintainability](https://camo.githubusercontent.com/fe33baefdf6538005ec9e105924ed48a101f304de9c0b15785e8eed99dd395ea/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65326133316138636234646632316166636164332f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/Pink-Crab/Perique_Admin_Menu/maintainability)

Why?
----

[](#why)

WordPress admin pages can be added with a simple function, but this can easily lead into messy structural code with includes for templates and the inevitable mixing of logic and presentation in templates.

The Admin Menu module gives full access to Perique DI Container, for more separation of logic and presentation, with the added advantage of all your services being easy to test and reason with.

**Requires [Perique](https://github.com/Pink-Crab/Perique-Framework)** - for more details please visit our docs.

Setup
=====

[](#setup)

Include the module using composer (via CLI)

```
$ composer require pinkcrab/perique-admin-menu
```

Once this has been included, we can add the module to Perique and its underlying Middleware will be added to the registration process.

```
$app = ( new PinkCrab\Perique\Application\App_Factory() )
  // Perique bootstrapping as normal.
  ->module( Admin_Menu::class )
  ->boot();
```

Once the middleware has been included, we can use Page &amp; Group models as part of the usual [Registration](https://perique.info/core/Registration/) process

Usage
=====

[](#usage)

It is possible to register either a single page or a group of pages.

Group
-----

[](#group)

A page can be used to register a group of pages, that can be registered as a top level menu item, or as a sub menu item of another page.

```
class My_Group extends Abstract_Group{
  // Required
  protected string $group_title = 'My Page Group';
  protected string $primary_page = 'Acme\My_Plugin\Page\Primary_Page';
  protected array $pages = array(
    'Acme\My_Plugin\Page\Secondary_Page',
    'Acme\My_Plugin\Page\Tertiary_Page',
  );

  // Optional
  protected string $capability = 'edit_posts';    // Defaults to manage_options
  protected string $icon = 'dashicons-chart-pie'; // Defaults to dashicons-admin-generic
  protected int $position = 24;                   // Defaults to 65
}
```

It is possible to enqueue scripts and styles, explicitly for this group using the [enqueue method](./docs/group.md#public-function-enqueue-abstract_group-group-page-page--void). This would see those scripts and styles only loaded on the pages within the group.

Please see the [group docs](./docs/group.md) for more details.

Page
----

[](#page)

A page is a single menu item, that can be registered as a top level menu item, or as a sub menu item of another page.

```
class My_Page extends Menu_Page{

  // Required
  protected string $page_slug = 'acme_pages';
  protected string $page_title = 'Acme Pages';
  protected string $menu_title = 'Acme Pages';

  // Optional
  protected ?string $parent_slug = null;       // If null, will be a top level menu item.
  protected string $capability = 'edit_post';  // Default capability for page.
  protected ?int $position = 12;

  // View to render
  protected string $view_template = 'my-page.php';
  protected array $view_data = array('key' => 'value');
}
```

It is possible to enqueue scripts and styles, explicitly for this page using the [enqueue method](./docs/page.md#public-function-enqueue-page-page--void).

You can also trigger a callback on page load, using the [load method](./docs/page.md#public-function-load-page-page--void).

For more details on the Page model, please see the [Page docs](./docs/page.md)

---

### Page Form Handling Example

[](#page-form-handling-example)

```
class Settings_Page extends Menu_page{
  // Page definitions.
  protected string $page_slug = 'acme_pages';
  protected string $page_title = 'Acme Pages';
  protected string $menu_title = 'Acme Pages';
  protected string $view_template = 'my-page.php';

  // Custom form handler service.
  private Form_Handler $form_handler;

  // Injected settings service and the form handler.
  public __construct( Settings $settings, Form_Handler $form_handler ){
    $this->form_handler = $form_handler;
    $this->view_data = $settings->as_array();
  }

  // On page load, check if form has been submitted, and if so, handle it.
  public function load( Page $page ): void{
    if( $this->form_handler->is_submitted() ){
      $new_settings = $this->form_handler->handle();
      $this->view_data = $new_settings;
    }
  }
}
```

In the above example the page would be use the settings from the `Settings` service, and if the form has been submitted, it would use the `Form_Handler` service to handle the form and update the view data.

Example
=======

[](#example)

There is a basic example of how to use this Module as part of a plugin, please see [Example Plugin](https://github.com/gin0115/Perique-Menu-Page-Example)

License
=======

[](#license)

MIT License
-----------

[](#mit-license)

Contributions
=============

[](#contributions)

If you would like to contribute to this or any other Perique module, please feel free to submit a PR with your changes.

All code must be supplied with matching tests and must pass PHPUNIT, PHPStan and PHPCS checks and not see a large drop in coverage.

See composer.json for details on the test and linting commands. `composer all` is the most important.

Change Log
==========

[](#change-log)

- 2.1.1 - Updated dev dependencies. Fixed page double-registration when the same Page class appears in both `registration_classes()` and an `Abstract_Group`'s `primary_page` / `$pages` (#58). Introduced the DI-managed `Group_Page_Registry` service and the `Hooks::GROUPS_PROCESSED` action so downstream modules (e.g. Settings\_Page) can wire DI rules for pages declared only inside a Group. See [docs/group.md](docs/group.md#hooks) for the hook contract.
- 2.1.0 - Added support for Perique 2.1.x and updated some dev dependencies.
- 2.0.0 - Migrated to Perique 2.0.0
- 1.0.1 - Separated out the docs and added `page_hook()` method to page models and sets the hook after registration.
- 1.0.0 - Finalised API for Perique 1.4.\*
- 0.2.1 - Allows pages that extend Menu\_Page to be registered as both parent of child pages.
- 0.2.0 - Re introduced the `register()` and `load()` methods for both Groups and Pages.
- 0.1.2 - Fixed hardcoded primary page slug in Page\_Dispatcher, updated dev dependencies
- 0.1.1 - Bumped version for Collection
- 0.1.0 - Migrated from [https://github.com/Pink-Crab/Module\_\_Admin\_Pages](https://github.com/Pink-Crab/Module__Admin_Pages)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance92

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 99.3% 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 ~172 days

Recently: every ~283 days

Total

11

Last Release

52d ago

Major Versions

0.2.1 → 1.0.02023-03-26

1.0.1 → 2.0.02023-04-03

PHP version history (4 changes)0.1.0PHP &gt;=7.1.0

0.2.1PHP &gt;=7.2.0

2.0.0PHP &gt;=7.4.0

2.1.1PHP &gt;=8.0.0

### Community

Maintainers

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

---

Top Contributors

[![gin0115](https://avatars.githubusercontent.com/u/28779094?v=4)](https://github.com/gin0115 "gin0115 (149 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pinkcrab-perique-admin-menu/health.svg)

```
[![Health](https://phpackages.com/badges/pinkcrab-perique-admin-menu/health.svg)](https://phpackages.com/packages/pinkcrab-perique-admin-menu)
```

PHPackages © 2026

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