PHPCraft
An open-source Minecraft: Java Edition server implementation, written in PHP.
What is PHPCraft?
PHPCraft is an open-source Minecraft: Java Edition server implementation, written in PHP.
That being said, PHPCraft is not intended to ever become a fully-functional, production-ready Minecraft server. It is simply a project that I work on for fun in my free time, because the idea of writing a Minecraft server implementation in PHP is just really amusing to me.
PHPCraft is a fork of Andrew Vy's HHVMCraft project.
※ Note: While HHVMCraft did (as the name would suggest) support HHVM, PHPCraft does not.
Which Minecraft versions are supported?
PHPCraft currently targets and supports Minecraft Beta b1.7.3 (Beta/pre-Netty Protocol 14), but you can connect to it with modern (Netty) Minecraft versions (1.8.9 and 1.7.10) using DirtMultiVersion, with support for all newer versions including 1.18.1 and 1.17.1 provided by ViaVersion (see below for screenshots!).
I would have targeted and supported a modern Minecraft version if I were writing PHPCraft from scratch today, but since this is based off of an existing project that already had a large amount of work done for b1.7.3 already… supporting a modern version would have pretty much required a full rewrite and would be a lot of work for what is again, just a project I'm doing for fun in my free time.
(Maybe if I ever somehow just have too much free time some day, perhaps… ;P)
※ Regarding Bedrock Edition clients connecting using Geyser: Geyser currently does not work correctly with PHPCraft for still-unknown reasons (all the blocks are invisible), despite the fact that Geyser does work just fine with DirtMultiVersion when connected to other servers (which means it's likely an issue in PHPCraft specifically).
Screenshots
A Minecraft 1.17.1 client connected to a PHPCraft server using DirtMultiVersion (and ViaVersion). A Minecraft Beta b1.7.3 client was also connected to the PHPCraft server at the same time, viewing the same world.
(There are no doors or beds because those blocks do not work correctly yet in PHPCraft.)
The same Minecraft 1.17.1 client connected to the same PHPCraft server, but at a later time of day.
More screenshots can be found in the screenshots folder that include more times of day, as well as screenshots of the Minecraft Beta b1.7.3 client that was also connected to the same PHPCraft server at the time.
How do I run PHPCraft?
Prerequisites
- PHP 8.x (recommended, actively used in development) or PHP 7.4 to 7.2
brew install php
on macOS (requires Homebrew to be installed)sudo apt install php
on Debian-based Linux distributions- PHP for Windows
- The "Non Thread Safe" version is sufficient for our purposes, as PHPCraft only uses PHP on the CLI, and not as part of a web server.
- Composer
brew install composer
on macOS (requires Homebrew to be installed)- Follow these instructions on Linux
- Use the Composer installer on Windows
Running PHPCraft
git clone https://github.com/akemin-dayo/PHPCraft.git
cd PHPCraft
composer install
php start.php # ./start.php also works
You can configure various options in start.php
, including (but not limited to) both the server port (25565
by default) and the IP address to bind to (0.0.0.0
by default)!
Useful developer resources
- Protocol specification for Minecraft Beta b1.7.3 (Beta/pre-Netty Protocol 14) on wiki.vg (oldid 510)
- This is the last page revision pertaining to Beta/pre-Netty Protocol 14, made on 2011/08/14.
License
Licensed under the MIT License.