Browse Source

Merge pull request #2290 from hastinbe/add-ast-ext

Add AST extension
Shao Yu-Lung (Allen) 5 years ago
parent
commit
c6fe34db11
4 changed files with 39 additions and 0 deletions
  1. 20 0
      DOCUMENTATION/content/documentation/index.md
  2. 2 0
      docker-compose.yml
  3. 2 0
      env-example
  4. 15 0
      workspace/Dockerfile

+ 20 - 0
DOCUMENTATION/content/documentation/index.md

@@ -2004,6 +2004,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`<br>
 
 
+
+
+<br>
+<a name="Install-AST"></a>
+## 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.
+
+
+
+
 <br>
 <a name="phpstorm-debugging"></a>
 ## PHPStorm Debugging Guide

+ 2 - 0
docker-compose.yml

@@ -115,6 +115,7 @@ services:
           - INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT}
           - INSTALL_PING=${WORKSPACE_INSTALL_PING}
           - INSTALL_SSHPASS=${WORKSPACE_INSTALL_SSHPASS}
+          - INSTALL_AST=${WORKSPACE_INSTALL_AST}
           - INSTALL_YAML=${WORKSPACE_INSTALL_YAML}
           - INSTALL_MAILPARSE=${WORKSPACE_INSTALL_MAILPARSE}
           - PUID=${WORKSPACE_PUID}
@@ -123,6 +124,7 @@ services:
           - 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}

+ 2 - 0
env-example

@@ -153,6 +153,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 ###############################################
 

+ 15 - 0
workspace/Dockerfile

@@ -529,6 +529,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
 ###########################################################################