public | ||
src | ||
.env.example | ||
.gitignore | ||
composer.json | ||
composer.lock | ||
composer.phar | ||
LICENSE | ||
README.md | ||
tailwind.config.js | ||
tailwindcss |
Ecomm Store
PHP MVC Ecomm App w/SqliteDB
Goals for MVP
- Avoid using JavaScript - make it usable without
- Multicurrency sats/cents
- Store Credit
- Products, carts, checkout, orders, returns/refunds.
- Subscriptions/recurring payments
- Email sign-in links, email notifications
- Light/dark theme
Initial setup/install
Copy the .env.example
into .env
and edit with your preferences/credentials.
cp .env.example .env
vim .env
install composer packages using the composer.phar
executable included in this repo
chmod +x composer.phar
php composer.phar install
Use tailwind-cli to automatically generate /public/style.css
from /src/style.css
This repo includes an older tailwindcss
binary for Apple ARM M-series processors. I could not get recent versions to work properly.
chmod +x tailwindcss
./tailwindcss -i ./src/style.css -o ./public/style.css --watch
You should only use --watch
in development.
Tailwind (JavaScript) only generates the CSS file used in prod. We're still "avoiding JS".
Run it
Start the local Php server from the project root, serves only the /public folder
php -S localhost:8080 -t public
Goto http://localhost:8080
in your browser.
Development
Fork it and make changes if you want! Make a PR into main
.
Routing
/public/index.php
is the router, define all your urls there and assign a controller method for each route
Other app-wide defaults and vars are also set here.
Themeing
public/index.php
is also where all colors are defined. It uses tailwind class strings to cover both light and dark themes.
tailwind.config.js
can be used to define a custom color pallete.
There is a bit of JS used to set a cookie that the server can read. This cookie just contains the user's browser's theme preference so the server can efficiently deliver light/dark image assets based on the theme.
Composer
To add additional composer packages:
php composer.phar require <package/package>
Then commit the composer.json
.