Caution
There are too many components I would need to write from scratch. Hence, in my second approach,
I used the Symfony Components, which are by default standalone and usable: elias-knodel/wordpress-x-symfony
WordPress OOP attempts and best practices.
- Install Composer Dependencies
composer install
- Start Local Instance
docker compose up -d
- Install Composer Dependencies
docker compose exec wordpress composer install
-
Go to
http://localhost:8080
and install WordPress and change permalink settings OR -
Wait until you see the installation page and then execute these two commands
docker compose run --rm --remove-orphans wpcli core install --url="localhost:8000" --title="Local WordPress" --admin_user="admin" --admin_password="admin" --admin_email="admin@example.com"
docker compose run --rm --remove-orphans wpcli option update permalink_structure '/%postname%/'
- Stop Local Instance
docker compose down
- If you want you can easily reset the database
docker compose down -v
- All the code is an example of how you would implement modern Software architecture with WordPress.
- It uses the Rest API, a Serializer and more to allow easy synchronization between an extern and the WP Intern Database.
- Goal is to make this something like a boilerplate for future projects.
- Because it's just a boilerplate and under the MIT license, you can use it freely as a starting point for your own projects.
- Backend Settings for api mappings
- Queue system to sync something again / back if a job has failed
- Serializer for easier work with woocommerce.
- Example: Receiving a product as json and converting it to a WC_Product / saving it to the database.