Skip to content
A PHP library for all things Minecraft: Java Edition.
PHP C++
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update FUNDING.yml [skip ci] Nov 13, 2019
bin Bundle DLLs with get_window_size.exe Oct 8, 2019
data Minimize data JSON files Oct 6, 2019
docs Update docs [skip ci] Nov 14, 2019
plugins Have IntegratedServer send first packets instead of a plugin Nov 14, 2019
src Rename and improve realms classes Nov 14, 2019
tests Rename NBT classes Nov 10, 2019
.anylint Update .anylint Oct 3, 2019
.doxygen Remove deprecated doxygen options Nov 14, 2019
.gitattributes Simplify .gitattributes Jun 13, 2019
.gitignore Update .gitignore Oct 4, 2019
.travis.yml Update to PHP 7.1 Nov 11, 2019
LICENSE Plugins and fun Jan 24, 2019
README.md Move server to Phpcraft\server repository Nov 14, 2019
bin2hex.php Fix blocking stdin reads Aug 18, 2019
cache.php Initial permission system and some other stuff I happened to change Sep 8, 2019
client.php Create IntegratedServer class to keep server logic instead of server.php Nov 14, 2019
composer.json Add minecraft-java tag Nov 14, 2019
hex2bin.php Fix blocking stdin reads Aug 18, 2019
listping.php Improve listping output Oct 3, 2019
nbt.php Initial Unified Commands API (#6), still missing permissions tho Aug 20, 2019
packets.php Move PacketId to Phpcraft\Packet namespace and improve it Nov 11, 2019
proxy.php Have IntegratedServer send first packets instead of a plugin Nov 14, 2019
selfcheck.php Suggest Cone commands in selfcheck.php Nov 14, 2019
snbt.php Add Guardian entity metadata, improve naming and hierarchy Nov 8, 2019
uuid.php Use hellsh\UUID instead of custom class to avoid annoying type issues Aug 18, 2019

README.md

Phpcraft Build Status

A PHP library for all things Minecraft: Java Edition.

Prerequisites

You'll need PHP (CLI), Composer, and Git.

Instructions

  • Debian: apt-get -y install php-cli composer git
  • Windows:
    1. Install Cone, which will install the latest PHP with it.
    2. Run cone get composer as administrator.
    3. Install Git for Windows.

Using the Phpcraft CLI utilities

First, we'll clone the repository and generate the autoload script:

git clone https://github.com/Phpcraft/core Phpcraft
cd Phpcraft
composer install --no-dev --no-suggest --ignore-platform-reqs

Next, we'll run a self check:

php selfcheck.php

If any dependencies are missing, follow the instructions, and then run the self check again.

Finally, you can use the Phpcraft CLI utilities:

  • php client.php help — A chat client with basic plugin support and built-in commands; type .help for more information.
  • php proxy.php help — A proxy with plugin support allowing you to play as another account.
  • php listping.php — A listping utility.
  • php snbt.php — A tool to convert SNBT.
  • php nbt.php — A tool to read binary NBT files.
  • php hex2bin.php — A tool to convert hexadecimal strings and files to their binary representation.
  • php bin2hex.php — A tool to convert binary strings and files to their hexadecimal representation.
  • php uuid.php — A tool to convert UUIDs.
  • php packets.php — A tool to print packets from a binary file, e.g. recorded by WorldSaver.
  • php cache.php — An interface to manage Phpcraft's resource cache.

Here's an example chain to convert SNBT to a binary NBT file:

php snbt.php "{Level: 9001}" | tail -n 1 | php hex2bin.php > nbt.bin

Using Phpcraft as a library

Thanks to Composer, using Phpcraft as a library is really easy. Just head into your project folder and run:

composer require timmyrs/phpcraft:dev-master --no-suggest --ignore-platform-reqs

Next, we'll run a self check:

php vendor/timmyrs/phpcraft/selfcheck.php

If any dependencies are missing, follow the instructions, and then run the self check again.

Finally, you can require "vendor/autoload.php"; to use Phpcraft's many APIs.

In addition to the CLI utilities above and the "Projects using Phpcraft" section below serving up great example code, there's also the docs and wiki for you to read.

Projects using Phpcraft

  • Phpcraft Server: A server based on Phpcraft's integrated server.
  • mcverify: A REST API for linking your users' Minecraft accounts.

Thanks

  • Thanks to wiki.vg and the people who're maintaining it.
  • Thanks to Jetbrains for providing me with an open-source license for PhpStorm — it's a lovely PHP IDE, and made working on this project much easier.

Phpcraft is not partnered or associated with Microsoft or Mojang.

You can’t perform that action at this time.