wp-forge / wp-plugin
Create a new WordPress plugin via Composer
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Type:wordpress-plugin
pkg:composer/wp-forge/wp-plugin
Requires
- php: >=7.4
- ext-curl: *
- ext-readline: *
- wp-forge/helpers: ^2.0
README
A WordPress plugin scaffolding template that can be easily installed using Composer.
Requirements
Installation
Run this command in the terminal:
composer --remove-vcs create-project wp-forge/wp-plugin
Be sure to append a directory name to the end of the command to customize the folder name that your project will be installed into!
The installation process will check your environment for the required PHP version and PHP extensions. If this presents a
problem and you want to force install anyway, just add the --ignore-platform-reqs flag to the command.
Notes
- The
.scriptsand.templatesfolders are used for scaffolding purposes only and won't exist in your end project. - We use the
@wordpress/envpackage to provide a local development environment. This package requires Docker to be installed on your machine. If you don't want to use Docker, you can remove the@wordpress/envpackage from thepackage.jsonfile and delete the.wp-env.jsonfile. - We use the concept of a hooks folder. Rather than having a bunch of WordPress hooks scattered around your
plugin, the
hooksfolder contains anactionsandfiltersfolder where each file name corresponds to the name of a hook (except with dashes in place of underscores). All items that belong in a particular hook are added to the appropriate file, making it easy to find, edit, and add hooks in a consistent way. - This repo has a
sourcefolder, where you can store any files that require a build step (e.g. scss and js). Theassetsfolder is where you store the compiled files that will be used in your plugin. By default, we .gitignore theassets/cssandassets/jsfolders. - Currently, this template does not implement any kind of build process. This is something that will be added in the future.
- This repo creates an
.nvmrcfile. If you use NVM, you'll be able to runnvm useto automatically switch to the correct version of Node for this project. It will default to the version of Node that is running on your machine at the time of install. - This template creates GitHub Action workflows for your plugin. If you are publicly releasing your plugin on the
WordPress.org plugin directory, you will need to add a
SVN_USERNAMEandSVN_PASSWORDenvironment variable to your GitHub repository settings. - If your plugin is to be publicly released, the
.wporgfolder is used to store the assets that will be uploaded to the WordPress.org plugin repository.
Reminders
Don't forget to:
- Run
git remote add origin <url>to add your remote repository - Add a
SVN_USERNAMEandSVN_PASSWORDenvironment variable to your GitHub repository settings (if your plugin is to be publicly released) - Push your code to GitHub by running
git push -u origin master