File tree Expand file tree Collapse file tree 13 files changed +145
-7
lines changed Expand file tree Collapse file tree 13 files changed +145
-7
lines changed Original file line number Diff line number Diff line change 1+ .git
2+ runtime
Original file line number Diff line number Diff line change 1+ root = true
2+
3+ [* ]
4+ charset = utf-8
5+ indent_style = space
6+ indent_size = 4
7+ tab_width = 4
8+ end_of_line = lf
Original file line number Diff line number Diff line change 1- DB_DSN = mysql:host=localhost ;port=3306;dbname=mvc_framework
2- DB_USER = root
3- DB_PASSWORD =
1+ DB_DSN = mysql:host=db ;port=3306;dbname=php_mvc
2+ DB_USER = php_mvc
3+ DB_PASSWORD = php_mvc
Original file line number Diff line number Diff line change @@ -18,6 +18,17 @@ Minimalistic custom framework created for educational purposes.
18187 . Start php server by running command ` php -S 127.0.0.1:8080 `
19198 . Open in browser http://127.0.0.1:8080
2020
21+ ------
22+ ## Installation using docker
23+ Make sure you have docker installed. To see how you can install docker on Windows [ click here] ( https://youtu.be/2ezNqqaSjq8 ) . <br >
24+ Make sure ` docker ` and ` docker-compose ` commands are available in command line.
25+
26+ 1 . Clone the project using git
27+ 1 . Copy ` .env.example ` into ` .env ` (Don't need to change anything for local development)
28+ 1 . Navigate to the project root directory and run ` docker-compose up -d `
29+ 1 . Install dependencies - ` docker-compose exec app composer install `
30+ 1 . Run migrations - ` docker-compose exec app php migrations.php `
31+ 8 . Open in browser http://127.0.0.1:8080
2132
2233> The project was created along with Youtube Video Series "[ Build PHP MVC Framework] ( https://www.youtube.com/playlist?list=PLLQuc_7jk__Uk_QnJMPndbdKECcTEwTA1 ) ".
2334> I appreaciate if you share it.
Original file line number Diff line number Diff line change 1+ version : " 3.7"
2+
3+ services :
4+ app :
5+ build : ./docker
6+ image : thecodeholic/php_mvc
7+ ports :
8+ - " 8080:80"
9+ volumes :
10+ # Mount source-code for development
11+ - ./:/var/www
12+ db :
13+ image : mysql:8
14+ ports :
15+ - " 3307:3306"
16+ volumes :
17+ - mysql-data:/var/lib/mysql
18+ - ./docker/mysql-config.cnf:/etc/mysql/conf.d/config.cnf
19+ environment :
20+ MYSQL_ROOT_PASSWORD : root
21+ MYSQL_DATABASE : php_mvc
22+ MYSQL_USER : php_mvc
23+ MYSQL_PASSWORD : php_mvc
24+
25+ volumes :
26+ mysql-data:
Original file line number Diff line number Diff line change 1+ <VirtualHost *:80>
2+ ServerAdmin webmaster@localhost
3+ DocumentRoot /var/www/public
4+
5+ <Directory /var/www>
6+ Options Indexes FollowSymLinks
7+ AllowOverride All
8+ Require all granted
9+ </Directory>
10+ </VirtualHost>
Original file line number Diff line number Diff line change 1+ FROM php:8.1-apache
2+
3+ # Copy virtual host into container
4+ COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
5+
6+ # Enable rewrite mode
7+ RUN a2enmod rewrite
8+
9+ # Install necessary packages
10+ RUN apt-get update && \
11+ apt-get install \
12+ libzip-dev \
13+ wget \
14+ git \
15+ unzip \
16+ -y --no-install-recommends
17+
18+ # Install PHP Extensions
19+ RUN docker-php-ext-install zip pdo_mysql
20+
21+ # RUN pecl install -o -f xdebug-3.1.3 \
22+ # && rm -rf /tmp/pear
23+
24+ # Copy composer installable
25+ COPY ./install-composer.sh ./
26+
27+ # Copy php.ini
28+ COPY ./php.ini /usr/local/etc/php/
29+
30+ # Cleanup packages and install composer
31+ RUN apt-get purge -y g++ \
32+ && apt-get autoremove -y \
33+ && rm -r /var/lib/apt/lists/* \
34+ && rm -rf /tmp/* \
35+ && sh ./install-composer.sh \
36+ && rm ./install-composer.sh
37+
38+ # Change the current working directory
39+ WORKDIR /var/www
40+
41+ # Change the owner of the container document root
42+ RUN chown -R www-data:www-data /var/www
43+
44+ # Start Apache in foreground
45+ CMD ["apache2-foreground" ]
46+
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ php -r " copy('https://getcomposer.org/installer', 'composer-setup.php');"
4+ SIGNATURE=$( php -r " echo hash_file('SHA384', 'composer-setup.php');" )
5+ EXPECTED_SIGNATURE=$( wget -q -O - https://composer.github.io/installer.sig)
6+
7+ if [ " $EXPECTED_SIGNATURE " != " $SIGNATURE " ]
8+ then
9+ echo ' ERROR: Invalid installer signature'
10+ rm composer-setup.php
11+ exit 1
12+ fi
13+
14+ php composer-setup.php --quiet --install-dir=/usr/local/bin --filename=composer
15+ RESULT=$?
16+ rm composer-setup.php
17+ exit $RESULT
Original file line number Diff line number Diff line change 1+ [client]
2+ default-character-set = utf8mb4
3+
4+ [mysql]
5+ default-character-set = utf8mb4
6+
7+ [mysqld]
8+ init-connect =' SET NAMES utf8mb4'
9+ collation_server =utf8mb4_unicode_ci
10+ character_set_server =utf8mb4
11+ default_authentication_plugin = mysql_native_password
Original file line number Diff line number Diff line change 1+ ; General
2+ upload_max_filesize = 200M
3+ post_max_size = 220M
You can’t perform that action at this time.
0 commit comments