AS Miusage API Plugin is a WordPress plugin. It retrieves data from a remote API endpoint, caches it, and makes it accessible through a custom WordPress API endpoint. The plugin features a Gutenberg block for displaying the data, an admin page for data management, and a WP-CLI command for refreshing the data.
- Custom API endpoint for retrieving cached data
- Gutenberg block for displaying data with toggleable columns
- Admin page for data display and management
- WP-CLI command for forcing data refresh
- Hourly caching of API data
- Multilingual support
- Proper data sanitization, escaping, and validation throughout the plugin
- Download the plugin zip file from the latest release.
- Log in to your WordPress admin panel.
- Go to Plugins > Add New.
- Click on the "Upload Plugin" button at the top of the page.
- Choose the downloaded zip file and click "Install Now".
- After installation, click "Activate Plugin" to enable the AS Miusage API Plugin.
- Clone this repository into your WordPress plugins directory:
git clone https://github.com/andresj-sanchez/as-miusage-api-plugin-project.git - Navigate to the plugin directory:
cd plugins/as-miusage-api-plugin - Install dependencies:
composer install npm install - Build assets:
npm run build - Navigate to the Block directory and install its dependencies:
cd src/Block npm install npm run build - Activate the plugin through the WordPress admin interface.
- Add the "AS Miusage API Data Table" block to your post or page.
- Use the block settings to toggle column visibility.
- Navigate to "AS Miusage API" in the WordPress admin menu.
- View the data table and use the "Refresh Data" button to update the cache.
To force a data refresh, use the following command:
wp as-miusage-api refresh
The plugin's admin page displaying the data table and refresh button.
The AS Miusage API Data Table block in the Gutenberg editor.
How the data table appears on the frontend of the website.
- Docker
- Docker Compose
- Node.js and npm
- Start the Docker environment:
docker-compose up -d - Wait for the WordPress container to fully initialize. This may take a few minutes as it runs configuration scripts.
- Access the WordPress site at
http://localhost:8080
- To build assets once:
npm run build - For development with watch mode:
npm run start
This project follows WordPress coding standards. To check your code, run:
composer run-script phpcs
To automatically fix some coding standard issues, run:
composer run-script phpcbf
The plugin is translation-ready. All user-facing strings are wrapped in translation functions. The main POT file is located at:
assets/languages/as-miusage-api-plugin.pot
This project is licensed under the GNU General Public License v2.0 or later (GPL-2.0-or-later).
- For a full copy of the license, see the LICENSE file in this repository.
- For more information about the GPL-2.0 license, visit: https://www.gnu.org/licenses/gpl-2.0.html