mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 11:39:18 +02:00
- Moved /lib → /src (PHP source code)
- Moved /includes → /public/includes (main site templates)
- Admin section remains self-contained in /public/admin with its own /inc
- Updated all require/include paths across codebase
- Updated config/bootstrap.php, justfile, tests, docs
- All tests passing ✅
Structure now follows PHP best practices:
/config - Configuration files
/database - SQLite database + schema
/docs - Documentation (intact)
/nginx - Server config (intact)
/public - Web-accessible files (entry point)
/admin - Self-contained admin interface
/assets - CSS, fonts, icons
/includes - Main site templates (header/footer)
/scripts - Deployment scripts (intact)
/src - PHP source classes (Database, AdminAuth, RateLimit)
/tests - Test suites
3.4 KiB
3.4 KiB
Repository Restructure Plan
Current Structure
posterg-website/
├── apps/
│ ├── public/ # Public website
│ └── admin/ # Admin panel
├── shared/ # Shared PHP libraries
├── database/ # Database files
├── nginx/ # Server config
└── docs/ # Documentation
Proposed Structure (Idiomatic PHP)
posterg-website/
├── index.php # Public website root
├── memoire.php
├── search.php
├── apropos.php
├── contact.php
├── licences.php
├── assets/ # Static files (CSS, JS, images)
│ ├── posterg.css
│ ├── normalize.css
│ └── fonts/
├── inc/ # Page templates/partials
│ ├── header.php
│ └── footer.php
├── lib/ # Shared libraries (renamed from shared/)
│ ├── Database.php
│ ├── RateLimit.php
│ ├── config.php
│ └── cache/
├── admin/ # Admin panel (from apps/admin/)
│ ├── index.php
│ ├── list.php
│ ├── edit.php
│ └── ...
├── database/ # Database files & schema
│ ├── schema.sql
│ ├── test.db
│ └── ...
├── vendor/ # Third-party dependencies (gitignored)
│ └── php-live-reload/ # Local dev only
├── nginx/ # Server configuration
├── docs/ # Documentation
├── tests/ # Tests (future)
└── .gitignore # Updated
Benefits
✅ Standard PHP structure - Follows common conventions
✅ Flatter hierarchy - Easier to navigate
✅ Clear separation - lib/ for code, inc/ for templates, assets/ for static files
✅ Simpler paths - Less ../../ in require statements
✅ Vendor folder - Standard for third-party code
Migration Steps
1. Move public to root
mv apps/public/* .
2. Move admin
mv apps/admin admin/
rm -rf apps/
3. Rename shared to lib
mv shared lib/
4. Update all require paths
require_once __DIR__ . '/shared/Database.php'→require_once __DIR__ . '/lib/Database.php'require_once __DIR__ . '/../shared/Database.php'→require_once __DIR__ . '/../lib/Database.php'
5. Setup vendor for local dev
mkdir -p vendor/
echo "vendor/" >> .gitignore
Path Changes Summary
| Old Path | New Path |
|---|---|
apps/public/index.php |
index.php |
apps/public/inc/header.php |
inc/header.php |
apps/public/assets/posterg.css |
assets/posterg.css |
apps/admin/index.php |
admin/index.php |
shared/Database.php |
src/Database.php |
shared/config.php |
src/config.php |
shared/cache/ |
src/cache/ |
Deployment Changes
Before
rsync apps/public/ posterg:/var/www/html/
rsync apps/admin/ posterg:/var/www/html/formulaire/
rsync shared/ posterg:/var/www/html/shared/
After
rsync --exclude 'vendor' --exclude 'tests' . posterg:/var/www/html/
Much simpler!
PHP Live Reload Setup
For Local Development Only
- Clone to
vendor/php-live-reload/(gitignored) - Include in local dev server
- Auto-refresh browser on file changes
- Never deployed to production
Usage
# Setup (one time)
just setup-dev
# Start dev server with live reload
just serve-public # or serve-admin