A basic e-commerce site built using PHP, Alpine.js and Tailwind CSS.
- Have Docker installed
- Have Docker Compose installed
- Have NodeJs and NPM installed (optional but preferred)
- Have Composer installed (optional but preferred)
-
Clone the repository to your local machine:
git clone https://github.com/AlstonChan/Basic-E-Commerce
-
Then run the docker commands to spin up the container.
docker-compose up -d
-
Next you need to install required npm packages and composer packages, populate env file then build CSS output file.
If you do not have either
composer
ornpm
installed on your machine, you may use these tools in the container rather than having to download the tools. If you already have these tools install, you may skip the first 3 steps instead, unless your version of downloads output error when executing.-
Enter the container bash by using
exec
commanddocker exec -it commerce-php8.2 bash
-
Next, change directory (cd) to where all the files are mounted to the container
cd /var/www/default
-
To confirm you are in the correct directory:
- Enter
pwd
should return/var/www/default
- Enter
ls -al
should list all the file you just clone
- Enter
-
Install
npm
packages and build CSS file. Here we build the css in watch mode, intended for development only, for more options, look at the NPM Options section.npm install npm run css:dev
-
Install
composer
packagescomposer install
-
Populate env file:
cp .env.sample .env
-
-
Navigate to http://localhost:3000 to visit the page or visit http://localhost:3001 for
phpmyadmin
page.
npm run css:dev
: Compile tailwind css in watch mode, updating the css on save, do not minify the css, suitable for development.npm run css:prod
: Compile tailwind css once and minify the css, suitable for production.
The configuration file for apache2.4
The configuration file for php 8.2
The configuration file for vscode extension PHP Intelephense, works with the extension to provide further code formatting capabilities. The full configuration can be found on beautify GitHub.