manifest / integrations / ivan-hrk-plugin-based-addon
Ivan Hrk Api Based Addon
A WordPress plugin for retrieving and displaying data from a remote API with a custom Gutenberg block, admin panel, and WP CLI command.
by Ivan Hryhorenko · github.com/land0r/ivan-hrk-plugin-based-addon
★ 0stars
20release downloads
≈10active sites
0forks
Install
The author publishes release zips, so WP-CLI can install straight from GitHub:
wp plugin install https://github.com/land0r/ivan-hrk-plugin-based-addon/releases/download/1.2.1/ivan-hrk-api-based-addon.zipReadme
Ivan Hrk Api Based Addon
- Tags: api, cache, admin, Gutenberg
- Requires at least: 6.0
- Tested up to: 6.7
- Requires PHP: 8.0
- Stable tag: 1.2.1
- License: GPLv2 or later
- License URI: https://www.gnu.org/licenses/gpl-2.0.html
A WordPress plugin that retrieves and displays API data using a Gutenberg block and admin interface.
References
The following resources were used in the development of this plugin:
- Gutenberg Block Development:
- Styling Reference:
- WPForms WordPress Coding Standards (WPCS):
- Dependency Injection Approach:
- Hook-Based Plugin Structure:
Possible optimization
- create Interface for
Data_Storein case if we need different type of storages, depends on website setup (Transient, Redis, Memcache, ...). Data store can be conditional. Admin_Page.phprestructure and splitting into smaller classes- Validator and data format for REST API responses, check that we always have the same number of headers and row cells, etc.
- Add options for customization, user could change: cache lifetime, datetime format for date column
- For block: styling options, header, cells colors and background, font, border, padding and margin), block styles, etc.
- For block: add sorting options with possibility to enable/disable that functionality for some columns
Features
- Fetches data from a remote API endpoint:
https://miusage.com/v1/challenge/1/. - Stores and caches data to reduce redundant API calls (cache duration: 1 hour).
- Custom WordPress AJAX endpoint for retrieving data (works for both logged-in and logged-out users).
- Gutenberg block to display data in a customizable table format.
- Allows toggling visibility of individual table columns via block settings.
- Admin page styled like WP Mail SMTP, displaying API data with the ability to refresh the cache.
- WP CLI command to force cache clearing, bypassing the 1-hour cache limit.
- Fully localized and translatable strings for all user-facing text.
- Built using modern PHP standards (OOP, PSR-4, Composer) and WordPress Coding Standards.
Development Setup
Prerequisites
To set up the development environment for the plugin, ensure the following tools are installed on your system:
- Node.js (LTS version recommended, 14+)
- npm (comes with Node.js)
- Composer (PHP dependency manager)
- Git (for cloning and version control)
Steps
- Clone the Repository
Clone the repository to your local development environment:
git clone https://github.com/land0r/ivan-hrk-plugin-based-addon.git cd ivan-hrk-plugin-based-addon - Install PHP Dependencies
composer install - Install JavaScript Dependencies
npm install - Build JavaScript Files
npm run build - For live development with file watching, use:
npm run start
Installation
- Download latest release from the plugin repository.
- Place the plugin folder in your WordPress
wp-content/pluginsdirectory. - Activate the plugin via the WordPress admin dashboard.
Usage
Gutenberg Block
- Add the Ivan HRK API Table block in the Block Editor.
- Customize the visibility of columns using the block settings.
- Save and view the table on the frontend.
Admin Page
- Navigate to Dashboard > Ivan API Data in the admin panel.
- View fetched API data in a table format.
- Use the Clear Cache button to refresh the cache manually.
WP CLI Command
Run the following command to clear the cache manually:
wp ivan-api-based refresh-cacheRead the full README on GitHub →
Releases
| Tag | Published | Asset | Downloads |
|---|---|---|---|
| 1.2.1 | Dec 20, 2024 | ivan-hrk-api-based-addon.zip | 7 |
| 1.2.0 | Dec 20, 2024 | ivan-hrk-api-based-addon.zip | 5 |
| 1.1.0 | Dec 20, 2024 | ivan-hrk-api-based-addon.zip | 7 |
| 1.0.0 | Dec 19, 2024 | ivan-hrk-api-based-addon.zip | 1 |
Active-site estimate ≈10 comes from the median of recent superseded releases. Method.