Options Bot
A simple bot to trade OPTIONS in WordPress plugin development using WordPress Rest API, WP-script, React, React Router, Tailwind CSS, PostCSS, Eslint, WP-Data, WP-Data Store, React Components, React CRUD, i18n, PHPUnit Test, JestUnit Test, WordPress Playwright e2e Test, Gutenberg blocks and PHP OOP plugin architecture easily in a minute.
What's included?
- WordPress Rest API
- WP-script Setup
- React
- React Router
- TypeScript
- Tailwind CSS [Nested + ]
- Scss
- PostCSS
- Eslint
- WP-Data
- WP-Data Redux Store [Redux Saga, Generator function, Thunk, Saga Middleware]
- React Components
- React CRUD Operations - Create, Reade, Update, Delete, Status changes and so many...
- Internationalization - WP i18n
- PHPUnit Test [Test + Fix]
- JestUnit Test
- WordPress Playwright e2e Test
- PHP OOP plugin architecture [Traits + Interfaces + Abstract Classes]
- Gutenberg blocks, Dynamic blocks
Quick Start
# Clone the Git repository
git clone https://github.com/dearvn/wp-options-bot.git
# Install PHP-composer dependencies [It's empty]
composer install
# Install node module packages
npm i
# Start development mode
npm start
# Start development with hot reload (Frontend components will be updated automatically if any changes are made)
npm run start:hot
# To run in production
npm run build
After running start
, or build
command, there will be a folder called /build
will be generated at the root directory.
Activate the plugin
You need activate the plugin from plugin list page. http://localhost/wpex/wp-admin/plugins.php
Zip making process [Build, Localization, Version replace & Zip]
# One by one.
npm run build
npm run makepot
npm run version
npm run zip
# Single release command - which actually will run the above all in single command.
npm run release
After running release
command, there will be a folder called /dist
will be generated at the root directory with options_bot.zip
project files.
Run PHP Unit Test
composer run test
Run all tests by single command - PHPCS, PHPUnit
composer run test:all
Run Jest Unit Test
npm run test:unit
Run Playwright e2e Test
Playwright doc link: https://playwright.dev/docs/running-tests
Requirements:
- Must have docker installed and running by ensuring these commands -
npm run env:stop
npm run env:start
Normal e2e test
npm run test:e2e
Interactive e2e test
npm run test:e2e:watch
For more about e2e Tests running please check - https://playwright.dev/docs/running-tests
PHP Coding Standards - PHPCS
Get all errors of the project:
composer run phpcs
Fix all errors of the project:
composer run phpcbf
Full Composer test run:
composer run test:all
Browse Plugin
http://localhost/wpex/wp-admin/admin.php?page=optionsbot#/
Where, /wpex
is the project root folder inside /htdocs
.
Or, it could be your custom processed URL.
REST API's
REST API Documentation
- Options Lists
- Method:
GET
- URL: http://localhost/wpex/wp-json/options-bot/v1/options
- Method:
- Orders Lists
- Method:
GET
- URL: http://localhost/wpex/wp-json/options-bot/v1/orders
- Method:
- Place order manually
- Method:
POST
- URL: http://localhost/wpex/wp-json/options-bot/v1/order
- Body:
{ }
- Method:
- Update Order
- Method:
PUT
- URL: http://localhost/wpex/wp-json/options-bot/v1/order/1
- Body:
{ }
- Method:
- Delete Order
- Method:
DELETE
- URL: http://localhost/wpex/wp-json/options-bot/v1/order
- Body:
{ "ids": [1, 2] }
- Method:
Detailed Documentation - View Detailed documentations with parameters and responses of the REST API
Options for specific files:
Get specific file errors of the project:
vendor/bin/phpcs options-bot.php
Fix specific file errors of the project:
vendor/bin/phpcbf options-bot.php
Versions
Contribution
Contribution is open and kindly accepted. Before contributing, please check the issues tab if anything in enhancement or bug. If you want to contribute new, please create an issue first with your enhancement or feature idea. Then, fork this repository and make your Pull-Request. I'll approve, if everything goes well.
Contact
It's me, Donaldit. Find me at donald.nguyen.it@gmail.com