This repository provides a starter template for WordPress plugin development using Composer. It demonstrates the use of PSR-4 standards for organizing your code into namespaces and includes the BrowserSync plugin to enable automatic webpage reloading when any file in the plugin folder is changed.
Before you begin, make sure you have the following prerequisites installed:
- Organize plugin code using PSR-4 namespaces for improved maintainability.
- Use Composer for managing PHP dependencies.
- Integrate BrowserSync to automatically reload the webpage when files are changed.
- Clone this repository to your local development environment:
git clone https://github.com/garydubb/wp-plugin-development-composer.git
- Navigate to the plugin directory:
cd wp-plugin-development-composer
- Install Composer dependencies:
composer install
- Install Node.js dependencies:
npm install
- Run BrowserSync to enable automatic webpage reloading:
npm run start:bs
- Start developing your plugin using the PSR-4 namespace structure within the src folder.
- Modify the plugin name, description, author, and other details in the composer.json file.
- Customize the PSR-4 namespace in the composer.json file to match your plugin's namespace.
- Adjust the BrowserSync configuration in the bs-config.js file as needed.
- Add your plugin code within the src directory, following the PSR-4 namespace structure.
- Use the provided BrowserSync setup to automatically reload the webpage during development.
Contributions to this project are welcome! If you have suggestions, improvements, or bug fixes, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.