A WordPress plugin to list external users into a virtual page.
- Technologies
- Plugin usage
- Install
- Interacting with plugin code
- Changelog
- License
- Improvements to be done
- PHP 7.4+ - At the moment the most recent version of PHP supported by WordPress;
- WordPress 6+ - The latest version of WordPress which gives us support for some front-end resources described below;
- Composer 2 - The latest version of Composer;
- PHPUnit 9.5 - The latest version supported by PHP previous to version 8;
- Mockery 1.5 - Mock classes out of the PHPUnit default scope;
- WP_Mock 0.5 - Mock WordPress user functions;
- FakerPHP 1.2 - Generate unit tests random data making tests results more reliable;
- NodeJS 14.0+ - Dependency for the front-end resources listed below;
- Webpack 5.75 - Manage front-end build process;
- Babel 7.20 - Transpile React code to ES5;
- React 17.0 - Javascript library used to consume the plugin APIs asynchronous. Has not been installed apart of WordPress as explained below;
- WordPress Dependency Extration Webpack Plugin 4.5 - Webpack plugin to allow consuming WordPress front-end resources, like React and its components, importing then as modules in others Javascript files.
This plugin expose two API endpoints to deal with users. They are:
- Users List - /wp-json/awesome-users/v1/list
- User Details - /wp-json/awesome-users/v1/details/{user_id}
The plugin front-end page can be found at this URL:
https://YOUR_WEBSITE.COM/my-awesome-users
The plugin makes use of WP_Object_Cache when doing external http requests, so it's completely viable to work with persistent cache plugins and tools like Redis or Memcached if you want more performance.
The cache can be easy applied to another functions just using the CacheTool utility like the example below:
$result = CacheTool::execute('key', function () {
return someSlowProcess();
});The closure will only be executed if the key is not cached.
Use the command below to install and load composer dependencies:
$ composer installUse the command below to install NPM dependencies and generate front-end assets:
$ npm run buildYou can also download the plugin from the repository releases here.
$ vendor/bin/phpcs$ vendor/bin/phpunitThe plugin change log can be found here.
The plugin license can be found here.
- Increase unit tests coverage;
- Add SASS and use it to style the plugin page;
- Create an NPM dev script with hot reload support;
- Change front-end build to support JSX extension and TypeScript.