WP Rocket installation from GitHub using Composer
WP Rocket can be installed directly from our GitHub repository:
- Composer - this has to be installed on the PC/server where you are planning to install WP Rocket.
- PHP 7.3 or greater - this is necessary to run Mozart, one of the dependencies, i.e. it's not WP Rocket's minimum supported PHP version.
To install WP Rocket from GitHub follow these steps:
- Copy WP Rocket’s installation folder in the /wp-content/plugin/ folder either by downloading and unzipping the plugin’s file:
or by using git:
git clone https://github.com/wp-media/wp-rocket.git
- In the terminal navigate to /wp-content/plugins/wp-rocket/
- Run the following command:
composer install --no-dev --no-scripts
This will create a
/vendor/ folder in WP Rocket’s root folder. It will include the 3rd-party libraries that WP Rocket uses.
Using composer at the root of a project?
The previous steps will work for installing the plugin via GitHub and running composer inside WP Rocket's plugin folder.
But if you are using Composer at the root of your project, you will need to add the following line so it is present early in the WordPress loading process. For example, in your
wp-config.php file :
require __DIR__ . '/vendor/autoload.php';
This will prevent issues with incorrect paths, that might cause the
/vendor folder to end up being created outside the WP Rocket folder.
For further information: https://composer.rarst.net/recipe/site-stack/
WP Rocket's License
To add your license's info you'll have to define the following two constants in the
define( 'WP_ROCKET_EMAIL', 'YOUR_ACCOUNT_EMAIL'); define( 'WP_ROCKET_KEY', 'YOUR_API_KEY');
YOUR_ACCOUNT_EMAILwith the email of your WP Rocket account.
YOUR_API_KEYwith your API Key.
To find your API Key, download WP Rocket from your account:
license-data.php file and copy the value of