From d71d0f12bd701abdf9c1e266f7ba04a4858f4259 Mon Sep 17 00:00:00 2001 From: jasonhilder Date: Fri, 29 May 2026 10:34:52 +0200 Subject: [PATCH] Update README.md --- README.md | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 174 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fee7abc..c6f8da9 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,176 @@ # miniPHP -A simple php skeleton to making small to medium scale websites/webapps. \ No newline at end of file +A tiny PHP starter project for small websites and personal projects. + +The goal is simple: + +- Clone +- Change git remote +- Start building + +No framework. +No ORM. +No dependency injection. +No magic. + +Just PHP. + +--- + +## Features + +- Simple config-based router +- Page and API endpoints +- SQLite support via PDO +- Shared partials +- Secure path traversal protection +- Helper functions +- Development server script + +--- + +## Project Structure + +```text +config/ +├── app.php +├── database.php +└── routes.php + +public/ +├── css/ +│ └── app.css +└── js/ + └── app.js + +src/ +├── api/ +├── views/ +│ ├── pages/ +│ └── partials/ +├── bootstrap.php +├── database.php +├── helpers.php +└── router.php + +storage/ +└── database.sqlite +``` + +--- + +## Running + +```bash +./server.sh +``` + +Default URL: + +```text +http://127.0.0.1:3333 +``` + +--- + +## Routes + +Routes are defined in: + +```php +config/routes.php +``` + +Example: + +```php +return [ + 'GET' => [ + '/' => 'home.php', + '/about' => 'about.php', + '/api/test' => 'api/example.php', + ], +]; +``` + +Routes beginning with: + +```text +api/ +``` + +are loaded from: + +```text +src/api/ +``` + +Everything else is loaded from: + +```text +src/views/pages/ +``` + +--- + +## Pages + +Example page: + +```php + 'Home', +]); + +?> + +

Home

+ +

Hello world.

+ +query( + 'SELECT * FROM users' +)->fetchAll(); +``` + +--- + +## Helpers + +Available helpers: + +```php +escape_string() +debug() +debugx() +get_config() +partial() +``` + +--- + +## License + +MIT \ No newline at end of file