For different versions of PHP, check the releases section.
- Clone This Repo
$ cp example.env .env- Change the
SITE_URLfield in.envto the domain you want (by default it'smycustomdomain.test) $ brew install mkcert nss$ ./generate-certs-mac.sh- Add an entry to your
/etc/hostsfile.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.ymlfile. (If you want to access the https website on port1337, then change443:443to1337:443underphpwebserver.) - If you want to access variables from your env file, by default in the
docker-compose.ymlI mount it as/etc/environmentin 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_names indocker-compose.yml.