Download the PHP package storepress/admin-utils without Composer
On this page you can find all versions of the php package storepress/admin-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download storepress/admin-utils
More information about storepress/admin-utils
Files in storepress/admin-utils
Package admin-utils
Short Description Utility Classes for WordPress Plugin Projects.
License GPL-2.0-or-later
Homepage https://github.com/EmranAhmed/storepress-admin-utils#readme
Informations about the package 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
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
It supports a rich set of field types including text
, textarea
, checkbox
, radio
, select
, color
, number
, and more advanced fields like toggle
switches and group
fields.
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
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
StorePress Admin Utils includes a robust module for managing plugin updates from a custom, non-WordPress.org 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
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
A key feature is the ability to roll back a plugin to a previous version.
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
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
The settings framework can automatically expose plugin settings via the WordPress REST API.
Endpoints
It creates REST API endpoints for fetching settings, allowing for headless WordPress implementations or integration with other applications.
Configuration
Developers can easily enable or disable this feature and customize the API namespace and version.
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
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
Usage
Plugin instance
Plugin AdminPage.php
Plugin AdminSettings.php
Section data structure
Field data structure
Plugin Settings.php
file
- Now use
Settings::instance();
onPlugin::init()
REST API
- URL will be:
/wp-json/<page_id>/<rest_api_version>/settings
Upgrade Notice
-
Show notice for incompatible extended plugin.
- Now use
Upgrade_Notice::instance();
onPlugin::init()
Plugin Update
-
NOTE: Update server and client server should not be same WordPress setup.
- You must add
Update URI:
on plugin file header to perform update.
Plugin Updater.php
file
- Now use
Updater::instance();
onPlugin::init()
Plugin Deactivate Feedback InactiveFeedback.php
- Now use
InactiveFeedback::instance();
onPlugin::init()