Skip to content

MVC Router for PHP; use routes like "/u/:user"

Notifications You must be signed in to change notification settings

felix-schindler/Router

Repository files navigation

Router

Since I'm mostly using SvelteKit and PocketBase, this Router is no longer maintained. Maybe when I'm getting bored, I'll fix / improve one or two things.

Why use this?

  • Dependency-free
  • MVC
  • No Models included, but you use PDO with the Query class
  • Easy to use readable URLs like /u/:name instead of things like user.php?name=

Requirements

Remove junk

# Remove composer things
rm -rf composer* vendor/ .phpstan.neon .vscode/tasks.json
# Remove docker things
rm docker-compose.yml Caddyfile

Development

# Clone git repo
git clone [email protected]:felix-schindler/Router.git && cd Router
# Run dev server
php -S localhost:8080 -t src/
# or
composer run dev

# OPTIONAL - Install testing dependencies
composer i
# Run unit tests and static code analysis
composer run test

Deploy

Docker

docker compose up

without Docker

Make sure your web server:

  • Supports PHP
  • Serves files
  • Routes through index.php (if the path doesn't match a file)

Tested on: Apache, Nginx, Caddy