Skip to content

Commit c6fe34d

Browse files
authored
Merge pull request laradock#2290 from hastinbe/add-ast-ext
Add AST extension
2 parents 9cea74d + dec428a commit c6fe34d

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
@@ -2004,6 +2004,26 @@ YAML PHP extension allows you to easily parse and create YAML structured data. I
20042004
4 - Re-build the container `docker-compose build php-fpm`<br>
20052005

20062006

2007+
2008+
2009+
<br>
2010+
<a name="Install-AST"></a>
2011+
## Install AST PHP extension
2012+
AST exposes the abstract syntax tree generated by PHP 7+. This extension is required by tools such as `Phan`, a static analyzer for PHP.
2013+
2014+
1 - Open the `.env` file
2015+
2016+
2 - Search for the `WORKSPACE_INSTALL_AST` argument under the Workspace Container
2017+
2018+
3 - Set it to `true`
2019+
2020+
4 - Re-build the container `docker-compose build workspace`
2021+
2022+
**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.
2023+
2024+
2025+
2026+
20072027
<br>
20082028
<a name="phpstorm-debugging"></a>
20092029
## PHPStorm Debugging Guide

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ services:
115115
- INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT}
116116
- INSTALL_PING=${WORKSPACE_INSTALL_PING}
117117
- INSTALL_SSHPASS=${WORKSPACE_INSTALL_SSHPASS}
118+
- INSTALL_AST=${WORKSPACE_INSTALL_AST}
118119
- INSTALL_YAML=${WORKSPACE_INSTALL_YAML}
119120
- INSTALL_MAILPARSE=${WORKSPACE_INSTALL_MAILPARSE}
120121
- PUID=${WORKSPACE_PUID}
@@ -123,6 +124,7 @@ services:
123124
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
124125
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
125126
- DRUSH_VERSION=${WORKSPACE_DRUSH_VERSION}
127+
- AST_VERSION=${WORKSPACE_AST_VERSION}
126128
- TZ=${WORKSPACE_TIMEZONE}
127129
- BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID}
128130
- BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}

env-example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ WORKSPACE_TIMEZONE=UTC
153153
WORKSPACE_SSH_PORT=2222
154154
WORKSPACE_INSTALL_FFMPEG=false
155155
WORKSPACE_INSTALL_GNU_PARALLEL=false
156+
WORKSPACE_INSTALL_AST=true
157+
WORKSPACE_AST_VERSION=1.0.3
156158

157159
### PHP_FPM ###############################################
158160

workspace/Dockerfile

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

532+
###########################################################################
533+
# AST EXTENSION
534+
###########################################################################
535+
536+
ARG INSTALL_AST=false
537+
ARG AST_VERSION=1.0.3
538+
ENV AST_VERSION ${AST_VERSION}
539+
540+
RUN if [ ${INSTALL_AST} = true ]; then \
541+
# Install AST extension
542+
printf "\n" | pecl -q install ast-${AST_VERSION} && \
543+
echo "extension=ast.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/ast.ini && \
544+
phpenmod -v ${LARADOCK_PHP_VERSION} -s cli ast \
545+
;fi
546+
532547
###########################################################################
533548
# fswatch
534549
###########################################################################

0 commit comments

Comments
 (0)