Dependency Management
PHP Dependency Management (Composer)
This project uses Composer to manage the WordPress core, themes, plugins, and third-party PHP libraries. The configuration is defined in composer.json, which ensures consistent environments across development and production.
Installation
To install all required PHP dependencies, run the following command from the project root:
composer install
This will generate the vendor directory and install the WordPress core files as specified in the configuration.
Adding New Dependencies
To add a new plugin (via WPackagist) or a PHP library, use the composer require command:
# Example: Adding a plugin from WPackagist
composer require wpackagist-plugin/akismet
# Example: Adding a PHP library
composer require monolog/monolog
Updating Dependencies
To update your dependencies to the latest versions allowed by your version constraints:
composer update
JavaScript Dependency Management (NPM)
Frontend dependencies, build tools, and automation scripts are managed via NPM. These are defined in the package.json file located in the project root (or within specific theme/plugin directories).
Installation
Before running build scripts, install the Node modules:
npm install
Build Scripts
The project includes several scripts for compiling assets (SASS, JS, etc.). Common commands include:
| Command | Description |
| :--- | :--- |
| npm run dev | Starts the development server or watcher for live-reloading. |
| npm run build | Compiles and minifies assets for production deployment. |
| npm run lint | Runs linting tools (ESLint/Stylelint) to ensure code quality. |
Usage Example
To compile assets for a production release, execute:
npm run build
Workflow Summary
For a fresh installation of the project, follow these steps to initialize all dependencies:
- Clone the repository.
- Install PHP packages:
composer install - Install JS packages:
npm install - Compile assets:
npm run build
Note: The
vendor/andnode_modules/directories are internal to the project's build process and are excluded from version control. Always run the installation commands after pulling changes from the remote repository.