diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index a9aeb8a1..55fbb1fd 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -299,6 +299,29 @@ For information on how to configure xDebug with your IDE and work it out, check +
+ +## Install pcov + +1 - First install `pcov` in the Workspace and the PHP-FPM Containers: +
+a) open the `.env` file +
+b) search for the `WORKSPACE_INSTALL_PCOV` argument under the Workspace Container +
+c) set it to `true` +
+d) search for the `PHP_FPM_INSTALL_PCOV` argument under the PHP-FPM Container +
+e) set it to `true` + +2 - Re-build the containers `docker-compose build workspace php-fpm` + +Note that pcov is only supported on PHP 7.1 or newer. For more information on setting up pcov optimally, check the recommended section +of the [README](https://github.com/krakjoe/pcov) + + +
## Start/Stop xDebug: diff --git a/docker-compose.yml b/docker-compose.yml index e4a4fc4b..5374b8d2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,6 +59,7 @@ services: - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} - INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION} - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG} + - INSTALL_PCOV=${WORKSPACE_INSTALL_PCOV} - INSTALL_PHPDBG=${WORKSPACE_INSTALL_PHPDBG} - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_SSH2=${WORKSPACE_INSTALL_SSH2} @@ -148,6 +149,7 @@ services: - LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG} + - INSTALL_PCOV=${PHP_FPM_INSTALL_PCOV} - INSTALL_PHPDBG=${PHP_FPM_INSTALL_PHPDBG} - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_SSH2=${PHP_FPM_INSTALL_SSH2} diff --git a/env-example b/env-example index 0e80c21b..39dd35cb 100644 --- a/env-example +++ b/env-example @@ -97,6 +97,7 @@ WORKSPACE_INSTALL_PHPREDIS=true WORKSPACE_INSTALL_WORKSPACE_SSH=false WORKSPACE_INSTALL_SUBVERSION=false WORKSPACE_INSTALL_XDEBUG=false +WORKSPACE_INSTALL_PCOV=true WORKSPACE_INSTALL_PHPDBG=false WORKSPACE_INSTALL_SSH2=false WORKSPACE_INSTALL_LDAP=false @@ -157,6 +158,7 @@ PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true PHP_FPM_INSTALL_PHPREDIS=true PHP_FPM_INSTALL_MEMCACHED=false PHP_FPM_INSTALL_XDEBUG=false +PHP_FPM_INSTALL_PCOV=false PHP_FPM_INSTALL_XHPROF=false PHP_FPM_INSTALL_PHPDBG=false PHP_FPM_INSTALL_IMAP=false diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 68a1933e..bc748698 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -164,6 +164,25 @@ RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/e sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini +########################################################################### +# pcov: +########################################################################### + +USER root + +ARG INSTALL_PCOV=false + +RUN if [ ${INSTALL_PCOV} = true ]; then \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") != "0" ]; then \ + pecl install pcov && \ + echo "extension=pcov.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini && \ + echo "pcov.enabled" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \ + ;fi \ + ;fi \ +;fi + + ########################################################################### # Phpdbg: ########################################################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index cbbeb2e9..788244bd 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -324,6 +324,25 @@ RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${L sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini +########################################################################### +# pcov: +########################################################################### + +USER root + +ARG INSTALL_PCOV=false + +RUN if [ ${INSTALL_PCOV} = true ]; then \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") != "0" ]; then \ + pecl install pcov && \ + echo "extension=pcov.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini && \ + echo "pcov.enabled" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \ + ;fi \ + ;fi \ +;fi + + ########################################################################### # Phpdbg: ###########################################################################