diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index d83b442..b98fe30 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -1973,6 +1973,26 @@ YAML PHP extension allows you to easily parse and create YAML structured data. I 4 - Re-build the container `docker-compose build php-fpm`
+ + +
+ +## Install AST PHP extension +AST exposes the abstract syntax tree generated by PHP 7+. This extension is required by tools such as `Phan`, a static analyzer for PHP. + +1 - Open the `.env` file + +2 - Search for the `WORKSPACE_INSTALL_AST` argument under the Workspace Container + +3 - Set it to `true` + +4 - Re-build the container `docker-compose build workspace` + +**Note** If you need a specific version of AST then search for the `WORKSPACE_AST_VERSION` argument under the Workspace Container and set it to the desired version and continue step 4. + + + +
## PHPStorm Debugging Guide diff --git a/docker-compose.yml b/docker-compose.yml index 07c47f6..9ed17d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -109,12 +109,14 @@ services: - INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT} - INSTALL_PING=${WORKSPACE_INSTALL_PING} - INSTALL_SSHPASS=${WORKSPACE_INSTALL_SSHPASS} + - INSTALL_AST=${WORKSPACE_INSTALL_AST} - PUID=${WORKSPACE_PUID} - PGID=${WORKSPACE_PGID} - CHROME_DRIVER_VERSION=${WORKSPACE_CHROME_DRIVER_VERSION} - NODE_VERSION=${WORKSPACE_NODE_VERSION} - YARN_VERSION=${WORKSPACE_YARN_VERSION} - DRUSH_VERSION=${WORKSPACE_DRUSH_VERSION} + - AST_VERSION=${WORKSPACE_AST_VERSION} - TZ=${WORKSPACE_TIMEZONE} - BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID} - BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN} diff --git a/env-example b/env-example index 0fd9d9d..09304a2 100644 --- a/env-example +++ b/env-example @@ -145,6 +145,8 @@ WORKSPACE_TIMEZONE=UTC WORKSPACE_SSH_PORT=2222 WORKSPACE_INSTALL_FFMPEG=false WORKSPACE_INSTALL_GNU_PARALLEL=false +WORKSPACE_INSTALL_AST=true +WORKSPACE_AST_VERSION=1.0.3 ### PHP_FPM ############################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 0fd26b6..baf8f22 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -508,6 +508,21 @@ RUN if [ ${INSTALL_INOTIFY} = true ]; then \ ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/inotify.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-inotify.ini \ ;fi +########################################################################### +# AST EXTENSION +########################################################################### + +ARG INSTALL_AST=false +ARG AST_VERSION=1.0.3 +ENV AST_VERSION ${AST_VERSION} + +RUN if [ ${INSTALL_AST} = true ]; then \ + # Install AST extension + printf "\n" | pecl -q install ast-${AST_VERSION} && \ + echo "extension=ast.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/ast.ini && \ + phpenmod -v ${LARADOCK_PHP_VERSION} -s cli ast \ +;fi + ########################################################################### # fswatch ###########################################################################