Skip to content

Commit b7ede26

Browse files
author
Beau Hastings
committed
Add ast extension
1 parent 861ea6b commit b7ede26

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

DOCUMENTATION/content/documentation/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,6 +1973,26 @@ YAML PHP extension allows you to easily parse and create YAML structured data. I
19731973
4 - Re-build the container `docker-compose build php-fpm`<br>
19741974

19751975

1976+
1977+
1978+
<br>
1979+
<a name="Install-AST"></a>
1980+
## Install AST PHP extension
1981+
AST exposes the abstract syntax tree generated by PHP 7+. This extension is required by tools such as `Phan`, a static analyzer for PHP.
1982+
1983+
1 - Open the `.env` file
1984+
1985+
2 - Search for the `WORKSPACE_INSTALL_AST` argument under the Workspace Container
1986+
1987+
3 - Set it to `true`
1988+
1989+
4 - Re-build the container `docker-compose build workspace`
1990+
1991+
**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.
1992+
1993+
1994+
1995+
19761996
<br>
19771997
<a name="phpstorm-debugging"></a>
19781998
## PHPStorm Debugging Guide

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ services:
109109
- INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT}
110110
- INSTALL_PING=${WORKSPACE_INSTALL_PING}
111111
- INSTALL_SSHPASS=${WORKSPACE_INSTALL_SSHPASS}
112+
- INSTALL_AST=${WORKSPACE_INSTALL_AST}
112113
- PUID=${WORKSPACE_PUID}
113114
- PGID=${WORKSPACE_PGID}
114115
- CHROME_DRIVER_VERSION=${WORKSPACE_CHROME_DRIVER_VERSION}
115116
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
116117
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
117118
- DRUSH_VERSION=${WORKSPACE_DRUSH_VERSION}
119+
- AST_VERSION=${WORKSPACE_AST_VERSION}
118120
- TZ=${WORKSPACE_TIMEZONE}
119121
- BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID}
120122
- BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}

env-example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ WORKSPACE_TIMEZONE=UTC
145145
WORKSPACE_SSH_PORT=2222
146146
WORKSPACE_INSTALL_FFMPEG=false
147147
WORKSPACE_INSTALL_GNU_PARALLEL=false
148+
WORKSPACE_INSTALL_AST=true
149+
WORKSPACE_AST_VERSION=1.0.3
148150

149151
### PHP_FPM ###############################################
150152

workspace/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,21 @@ RUN if [ ${INSTALL_INOTIFY} = true ]; then \
508508
ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/inotify.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-inotify.ini \
509509
;fi
510510

511+
###########################################################################
512+
# AST EXTENSION
513+
###########################################################################
514+
515+
ARG INSTALL_AST=false
516+
ARG AST_VERSION=1.0.3
517+
ENV AST_VERSION ${AST_VERSION}
518+
519+
RUN if [ ${INSTALL_AST} = true ]; then \
520+
# Install AST extension
521+
printf "\n" | pecl -q install ast-${AST_VERSION} && \
522+
echo "extension=ast.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/ast.ini && \
523+
phpenmod -v ${LARADOCK_PHP_VERSION} -s cli ast \
524+
;fi
525+
511526
###########################################################################
512527
# fswatch
513528
###########################################################################

0 commit comments

Comments
 (0)