A PHP browser strategy game engine — build your own Travian/OGame/Ikariam-style game. Fork it, configure it, play with friends.
Originally created by Aldrigo Raffaele (raffa50). This is a modernized fork of the phpSGEx 3.0 Alpha codebase.
git clone https://github.com/StevenG916/phpsgex4.git
cd phpsgex4
make upThat's it. Open http://localhost:8080 and you've got a running game.
- Game: http://localhost:8080
- Database admin: http://localhost:8081 (Adminer)
Default admin credentials are in .env (auto-created from .env.example on first make up).
make logs # Watch application logs
make shell # Shell into the app container
make db # MySQL CLI
make reset # Nuke everything and start fresh
make down # Stop all containersRequirements: PHP 8.2+, MySQL/MariaDB 10+, Apache with mod_rewrite
- Copy files to your web root
- Copy
.env.exampleto.envand edit database credentials - Visit
http://yourserver/— the installer will run automatically - First registered user becomes admin
phpSGEx is a game engine, not a finished game. It gives you:
- Multiple map systems — OGame-style galaxies or Travian-style flat grid
- Buildings, research, units — all configurable through the admin panel
- Combat — send armies to attack other players
- Alliances — diplomacy, shared vision, war/NAP/ally pacts
- Messaging — in-game mail with BBCode
- Plugin system — extend with custom controllers and features
- Admin panel — configure game speed, resources, races, and more
- Multi-language — EN, IT, DE, ES, BG, NL, RU
You configure the game data (what buildings exist, what units do, resource rates, etc.) and your players handle the rest.
- Docker support —
docker compose upand play - PHP 8.2+ — modern PHP with typed properties, enums, match expressions
- Security overhaul — Argon2id passwords, prepared statements, CSRF protection, XSS escaping
- Auto-setup — database initializes automatically on first boot
.envconfiguration — no more hardcoded credentials in PHP files
All configuration is in .env. Key settings:
| Variable | Description | Default |
|---|---|---|
GAME_NAME |
Server name shown to players | My Strategy Game |
GAME_MAP_SYSTEM |
1 = OGame-style, 2 = Travian-style | 2 |
ADMIN_USERNAME |
Initial admin account | admin |
ADMIN_PASSWORD |
Initial admin password | changeme_admin_password |
Game balance settings (resource rates, build times, etc.) are configured in the admin panel at ?pg=acp\Configs.
Licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0).
phpSGEx was originally created by Aldrigo Raffaele (raffa50) and released under a Creative Commons ShareAlike license. This fork keeps the same terms: you are free to use, modify, and redistribute it — including running your own private game servers — as long as you credit the original author and license any derivative work under the same terms.
Pull requests welcome. See PROJECT_PLAN.md for the roadmap and what needs work.