Find a file
count-null 4eb1d59230 save
2025-03-08 21:26:58 -05:00
public save 2025-03-08 21:26:58 -05:00
src save 2025-03-08 21:26:58 -05:00
.env.example save 2025-02-27 16:38:19 -05:00
.gitignore init 2025-02-09 12:02:22 -05:00
composer.json save 2025-02-27 16:38:19 -05:00
composer.lock save 2025-02-27 16:38:19 -05:00
composer.phar init 2025-02-09 12:02:22 -05:00
LICENSE Initial commit 2025-02-09 10:33:59 -05:00
README.md init 2025-02-09 12:02:22 -05:00
tailwind.config.js save 2025-02-25 19:21:31 -05:00
tailwindcss init 2025-02-09 12:02:22 -05:00

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.