For different versions of PHP, check the releases section.
- Clone This Repo
$ cp example.env .env
- Change the
SITE_URL
field in.env
to the domain you want (by default it'smycustomdomain.test
) $ brew install mkcert nss
$ ./generate-certs-mac.sh
- Add an entry to your
/etc/hosts
file.127.0.0.1 mycustomdomain.test
$ docker-compose up
Then open up https://mycustomdomain.test
. Put your PHP app in the /www
folder.
- If you want different ports (other than localhost:80), edit the
docker-compose.yml
file. (If you want to access the https website on port1337
, then change443:443
to1337:443
underphpwebserver
.) - If you want to access variables from your env file, by default in the
docker-compose.yml
I mount it as/etc/environment
in the container. In PHP you can grab the vars like this:
$env = parse_ini_file("/etc/enviornment", true, INI_SCANNER_RAW);
- If you want to ssh into the container, run the following:
$ docker exec -it lamp-boilerplate-phpwebserver /bin/bash
(Replace "lamp-boilerplate-phpwebserver" with whatever you name the container in docker-compose.yml
.)
- PHP MyAdmin only works over http... I'm open to a PR that fixes this.
- If you want to use this with multiple projects, make sure to change the
container_name
s indocker-compose.yml
.