is this package supposed to work as composer dependency?
I use https://github.com/wecodemore/wpstarter to build a website managed by composer. The file wp-rocket-cli.php is added to composer autoloader which is too early as WordPress itself cannot be integrated in composer autoloader (unfortunately).
So when I run wp plugin list for example I see:
Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() in /var/www/vendor/geekpress/wp-rocket-cli/wp-rocket-cli.php on line 15
Error: Call to undefined function plugin_dir_path() in /var/www/vendor/geekpress/wp-rocket-cli/wp-rocket-cli.php on line 15
Call Stack:
0.0002 392328 1. {main}() /var/www/vendor/wp-cli/wp-cli/php/boot-fs.php:0
0.0003 402784 2. require_once('/var/www/vendor/wp-cli/wp-cli/php/wp-cli.php') /var/www/vendor/wp-cli/wp-cli/php/boot-fs.php:17
0.0005 423888 3. WP_CLI\bootstrap() /var/www/vendor/wp-cli/wp-cli/php/wp-cli.php:27
0.0084 1710528 4. WP_CLI\Bootstrap\IncludeFallbackAutoloader->process() /var/www/vendor/wp-cli/wp-cli/php/bootstrap.php:74
0.0085 1712408 5. require('/var/www/vendor/autoload.php') /var/www/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/AutoloaderStep.php:49
0.0086 1725624 6. ComposerAutoloaderInit74a71a5755081da7e2cbe90778343e52::getLoader() /var/www/vendor/autoload.php:7
0.0701 8632224 7. composerRequire74a71a5755081da7e2cbe90778343e52() /var/www/vendor/composer/autoload_real.php:59
0.0701 8633128 8. require('/var/www/vendor/geekpress/wp-rocket-cli/wp-rocket-cli.php') /var/www/vendor/composer/autoload_real.php:69
A possible solution would be to make it a mu-plugin. That way it could not be deactivated but would be loaded after WordPress has been initialized.
Okay, my bad. This issue only affects version 1.0.0 and is already fixed in dev-master. If you come across this use composer require geekpress/wp-rocket-cli:dev-master until another release is available.
Hi there,
is this package supposed to work as composer dependency? I use https://github.com/wecodemore/wpstarter to build a website managed by composer. The file
wp-rocket-cli.php
is added to composer autoloader which is too early as WordPress itself cannot be integrated in composer autoloader (unfortunately).So when I run
wp plugin list
for example I see:A possible solution would be to make it a mu-plugin. That way it could not be deactivated but would be loaded after WordPress has been initialized.