Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/jvrhar/wp-custom-api-logger/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
A high-performance custom WordPress plugin built to log API events into a custom database table with REST API access, input sanitization, security checks, and Transients API caching for optimal performance.
🌟 Features
- Custom Database Architecture: Dynamically creates an optimized table on activation using
dbDelta(). - REST API Endpoints:
POST /wp-json/custom-logger/v1/log- Secure endpoint to accept log entries.GET /wp-json/custom-logger/v1/logs- Fetch latest log entries with automatic transient caching.
- Performance Optimization: Uses WordPress Transients API to reduce database read overhead on heavy query loads.
- Security First: Features permission callbacks, data sanitization (
sanitize_text_field), and dynamic query parameterization. - Design Pattern: Implemented using modern OOP Singleton Pattern.
🛠️ Architecture & Tech Stack
- Language: PHP 8.x
- Framework: WordPress Core APIs (
WP_REST_Server,$wpdb, Transients API) - Database: MySQL
- Version Control: Git
🚀 Installation & Usage
- Clone or download this repository into your
/wp-content/plugins/directory. - Activate the plugin via WordPress Admin Dashboard.
- Test POST requests to
/wp-json/custom-logger/v1/logvia Postman or cURL.