Skip to content

This is a dockerized basic project structure for PHP development.

Notifications You must be signed in to change notification settings

IOAyman/docker-phpdev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker PHP-Dev

This is a dockerized basic project structure for PHP development.

Things you should know

Your code should go into ./src

Web server

  • Exposed ports (host:container): 80:80
  • Web server: apache
  • PHP version: 7
  • Installed extensions: PDO (MYSQL,SQLITE)

Database

  • DB: MYSQL
  • DB hostname(what to put in your code): 'db'
  • DB environment is defined in ./db/env

How to import a database dump on startup?
Just put your file at ./db/schema.sql

How to import a .sql later on, after the startup?

cd db
bash import.sh mydump.sql

How to use this?

# Clone repo
git clone https://github.com/IOAyman/docker-phpdev.git myawesomeproject
cd myawesomeproject

# Do the house cleaning
python clean.py -h

usage: clean.py [-h] [-git] [-db dbname root_password user user_password]

Clean and re-initialize your project folder

optional arguments:
  -h, --help            show this help message and exit
  -git                  Re-initialize a git repository
  -db dbname root_password user user_password
                        Change the default database creadentials

# Run the containers
docker-compose -d up

# Test
curl localhost

# Shutdown the containers
docker-compose down

About

This is a dockerized basic project structure for PHP development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published