PHPackages                             storepress/admin-utils - 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. storepress/admin-utils

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

storepress/admin-utils
======================

Utility Classes for WordPress Plugin Projects.

3.6.1(1w ago)21.2kGPL-2.0-or-laterPHP

Since Nov 26Pushed 2w ago1 watchersCompare

[ Source](https://github.com/EmranAhmed/storepress-admin-utils)[ Packagist](https://packagist.org/packages/storepress/admin-utils)[ Docs](https://github.com/EmranAhmed/storepress-admin-utils#readme)[ RSS](/packages/storepress-admin-utils/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (45)Versions (56)Used By (0)

StorePress Admin Utils
======================

[](#storepress-admin-utils)

StorePress Admin Utils is a comprehensive PHP library for WordPress that simplifies the creation of admin interfaces for plugins. It provides a structured, object-oriented approach to building settings pages, managing plugin updates, handling rollbacks, and displaying administrative notices.

Core Features
-------------

[](#core-features)

Settings Framework
------------------

[](#settings-framework)

The library's cornerstone is its powerful settings framework, which allows developers to create complex settings pages with multiple tabs and a wide variety of field types.

### Field Types

[](#field-types)

It supports a rich set of field types including `text`, `unit`, `textarea`, `checkbox`, `toggle`,`radio`, `select`, `color`, `number`, and more advanced fields like `toggle` switches and `group` fields.

### Structure

[](#structure)

Settings are organized into sections and tabs, providing a clean and intuitive user experience. The framework handles the rendering of the entire settings page, including the navigation tabs, fields, and save/reset buttons.

### Data Management

[](#data-management)

It streamlines the process of saving, retrieving, and deleting plugin options from the database. It also includes mechanisms for data sanitization and validation.

Plugin Updater
--------------

[](#plugin-updater)

StorePress Admin Utils includes a robust module for managing plugin updates from a custom, non-WordPress.org server.

### Custom Update Server

[](#custom-update-server)

Developers can specify a URL to their own update server in the plugin's header. The library then communicates with this server to check for new versions.

### Update Process

[](#update-process)

It handles the entire update process, from checking for new versions and displaying update notifications in the WordPress admin to downloading and installing the new plugin package. The `README.md` file provides a clear example of how to set up the server-side endpoint to respond to update requests.

Plugin Rollback
---------------

[](#plugin-rollback)

A key feature is the ability to roll back a plugin to a previous version.

Simple DI Container
-------------------

[](#simple-di-container)

Simple DI Container with singleton and factory support.

### Rollback UI

[](#rollback-ui)

It adds a "Rollback" link to the plugin's action links on the plugins page. This leads to a dedicated page where the user can select a previous version to install.

### Version Management

[](#version-management)

The rollback functionality is tied into the update server, which must provide a list of available versions and their corresponding package URLs.

REST API Integration
--------------------

[](#rest-api-integration)

The settings framework can automatically expose plugin settings via the WordPress REST API.

### Endpoints

[](#endpoints)

It creates REST API endpoints for fetching settings, allowing for headless WordPress implementations or integration with other applications.

### Configuration

[](#configuration)

Developers can easily enable or disable this feature and customize the API namespace and version.

Upgrade &amp; Compatibility Notices
-----------------------------------

[](#upgrade--compatibility-notices)

The library provides a class for managing admin notices, which is particularly useful for handling compatibility issues between a primary plugin and its extensions. It can display notices in the admin area and on the plugins page if an incompatible version of an extension is detected.

Usage and Implementation
------------------------

[](#usage-and-implementation)

To use StorePress Admin Utils, developers typically extend the core classes provided by the library, such as `Settings`, `Updater`, and `Upgrade_Notice`. By implementing the abstract methods in these classes, developers can configure the library to suit their plugin's specific needs.

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

[](#installation)

```
composer require storepress/admin-utils
```

Usage
-----

[](#usage)

### Plugin entry file `plugin-example.php`

[](#plugin-entry-file-plugin-examplephp)

```
