-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathessentials.sh
49 lines (40 loc) · 1.27 KB
/
essentials.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
function runPhpEssentials()
{
RWDIR=${RWDIR:-"/var/php-essentials"} # Remote working directory
VOLUME_MODE=${VOLUME_MODE:-"r"} # Read or ReadWrite?
docker run -rm -i -t \
--volume ${PWD}:${RWDIR}:${VOLUME_MODE} \
--workdir ${RWDIR} \
darh/php-essentials $@
}
function runPhpInternalServer()
{
RWDIR=${RWDIR:-"/var/php-essentials"} # Remote working directory
VOLUME_MODE=${VOLUME_MODE:-"r"} # Read or ReadWrite?
# Address & port to bind to
PHPS_PORT=${PHPS_PORT:-"80"}
PHPS_HOST=${PHPS_HOST:-"0.0.0.0"}
docker run -rm -i -t \
--volume ${PWD}:${RWDIR}:${VOLUME_MODE} \
--workdir ${RWDIR} \
--publish ${PHPS_PORT}:${PHPS_PORT} \
darh/php-essentials \
php -S ${PHPS_HOST}:${PHPS_PORT} -t ${RWDIR} $@
}
# CLI
alias php="runPhpEssentials php"
# Try it: php -r 'echo getcwd(); print_r(`ls -lsa`);'
# Server
alias php-server="runPhpInternalServer"
# Tools
alias composer="runPhpEssentials composer"
alias pear="runPhpEssentials pear"
alias phpunit="runPhpEssentials phpunit"
alias phpcpd="runPhpEssentials phpcpd"
alias phpdcd="runPhpEssentials phpdcd"
alias phploc="runPhpEssentials phploc"
alias pdepend="runPhpEssentials pdepend"
alias phpcs="runPhpEssentials phpcs"
alias phpmd="runPhpEssentials phpmd"
alias behat="runPhpEssentials behat"