[READ ONLY] Example WordPress Plugin of Using Domain Driven Design (DDD) Approach, CQRS, and WordPress as an Infrastructure Layer.
- PHP: 8.2+
- WordPress: 6.5+
- node: 20.0+
- composer: 2.0+
It includes the following features:
- PHP Code Styles and Linting, also supports partial linting of staged files, upon commit.
- PHP Rector
- PHP Unit Testing
To install all the dependencies, run the following command:
$ npm install
To build the plugin's assets, run the following command:
$ npm run assets:build
Warning
The plugin's assets should be built 👆🏻before use, otherwise, the plugin will throw an error saying that the assets are missing.
To start the local env, run the following command:
$ npm run start
Once the env starts you can access the WordPress admin panel by visiting http://localhost:8888/wp-admin with the following credentials:
- Username:
admin
- Password:
password
To stop the local env, run the following command:
$ npm run stop
To run the PHP Code Style and Linting, run the following command:
$ npm run lint
To run the PHP Unit Testing, run the following command:
$ npm run test
The Container
class is a simple implementation of the PSR-11 container interface, for more details check the Container README.
The Template\Manager
class is responsible for locating and rendering template files within the Cosmo Users plugin.
It acts as a composite locator, utilizing multiple locators to find the desired template file.
Tip
To override the template file, you can create a new template file in your theme directory with the same name as the template file you want to override,
and placed it inside the one of the following folders: templates/cosmo-users
, templates-parts/cosmo-users
or parts/cosmo-users
.
Worth to mention that the template file w/i the child theme gets the most priority among all the other locations.
The Cache
instance is responsible for managing the cache data.
It provides a simple way to store and retrieve data from the cache.
For more details check the Cache README.
This package is licensed under the MIT License - see the LICENSE.md file for details.