|
| 1 | +# Installing HWP Toolkit Plugins with Composer |
| 2 | + |
| 3 | +You can install any HWP Toolkit plugin using Composer, which is the recommended way for modern WordPress development workflows. |
| 4 | + |
| 5 | +You can also install them manually from our [Releases](https://github.com/wpengine/hwptoolkit/releases) page. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +- Composer 1.x or 2.x |
| 10 | +- WordPress 6.0+ |
| 11 | +- PHP 7.4+ |
| 12 | + |
| 13 | +## Quick Start: Example `composer.json` |
| 14 | + |
| 15 | +Copy and use this example as your `composer.json` for a typical WordPress project using HWP Toolkit plugins: |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + "name": "wpengine/headless-wordpress-toolkit-composer-test", |
| 20 | + "description": "Headless WordPress Toolkit Composer Test", |
| 21 | + "repositories": [ |
| 22 | + { |
| 23 | + "type": "composer", |
| 24 | + "url": "https://raw.githubusercontent.com/wpengine/hwptoolkit/main/plugins/composer-packages.json" |
| 25 | + } |
| 26 | + ], |
| 27 | + "require": { |
| 28 | + "wpengine/hwp-previews": "*", |
| 29 | + "wpengine/wp-graphql-webhooks": "*" |
| 30 | + }, |
| 31 | + "config": { |
| 32 | + "allow-plugins": { |
| 33 | + "composer/installers": true |
| 34 | + } |
| 35 | + } |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +## Installation Steps |
| 40 | + |
| 41 | +1. **Copy the above JSON into your project's `composer.json` file.** |
| 42 | + |
| 43 | +2. **Install dependencies:** |
| 44 | + |
| 45 | + ```bash |
| 46 | + composer install |
| 47 | + ``` |
| 48 | + |
| 49 | +3. **Activate the plugin(s) in WordPress** |
| 50 | + |
| 51 | + Go to the WordPress admin and activate the plugin(s) as usual. |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## Updating |
| 56 | + |
| 57 | +To update to the latest version: |
| 58 | + |
| 59 | +```bash |
| 60 | +composer update wpengine/hwp-previews wpengine/wp-graphql-webhooks |
| 61 | +``` |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## Troubleshooting |
| 66 | + |
| 67 | +- If you see an error about missing `composer/installers`, run `composer require composer/installers`. |
| 68 | +- If the plugin does not appear in your plugins list, check your `installer-paths` and that you are in the correct WordPress directory. |
| 69 | +- Ensure the `repositories` section is present and correct in your `composer.json`. |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## Contributing |
| 74 | + |
| 75 | +If you feel like something is missing or you want to add documentation, we encourage you to contribute! Please check out our [Contributing Guide](https://github.com/wpengine/hwptoolkit/blob/main/CONTRIBUTING.md) for more details. |
0 commit comments