PHPackages                             gries/mcontrol - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. gries/mcontrol

ActiveLibrary[Admin Panels](/categories/admin)

gries/mcontrol
==============

PHP Library to control a running Minecraft-Server

v0.1.1-beta(12y ago)81201[1 issues](https://github.com/gries/MControl/issues)MITPHP

Since Nov 11Pushed 12y ago2 watchersCompare

[ Source](https://github.com/gries/MControl)[ Packagist](https://packagist.org/packages/gries/mcontrol)[ RSS](/packages/gries-mcontrol/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (5)Versions (5)Used By (0)

MControl
========

[](#mcontrol)

MControl is a library to controll a minecraft-server via. the rcon protocol.

[![SensioLabsInsight](https://camo.githubusercontent.com/10e83b36bb4a8edd474f9d509be11720d0b497ec4d884af5913e6b2e9659e420/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f33336262373166612d373434352d343262642d613165342d3032663935366237336363632f6269672e706e67)](https://insight.sensiolabs.com/projects/33bb71fa-7445-42bd-a1e4-02f956b73ccc)

[![Build Status](https://camo.githubusercontent.com/d205dc6a274b4d43f8d0e24dbddc3aacf6316db7283cc48dcf7182fc208e1d43/68747470733a2f2f7472617669732d63692e6f72672f67726965732f4d436f6e74726f6c2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/gries/MControl)

Installation
------------

[](#installation)

MControl can be installed via. Composer:

```
{
    "require": {
        "gries/MControl": "dev-master"
    },
     "minimum-stability": "dev"
}

```

Basic usage
-----------

[](#basic-usage)

```
use gries\MControl\Server\Commander;
use gries\MControl\Server\Rcon\RconManager;

// create a RconConnection
$rcon = new RconManager('localhost', 25575, 'p4ssw0rd');

// create a Commander
$commander = new Commander($rcon);

// set the server-time
$commander->setTime('12000');

// listPlayers
$players = $commander->listPlayers(); // -> array('playerx', 'playery');

// teleport one player to another
$commander->teleport(array('playerx', 'playery'));

// locate a player
$location = $commander->locate('playerx');  // -> array('x' => 157, 'y' => 50, 'z' => -54);

// execute a raw command
$response = $commander->raw('my custom command string');

```

Building structures
-------------------

[](#building-structures)

```
....
use gries\MControl\Builder\Block;
use gries\MControl\Builder\Structure;
use gries\MControl\Server\StructureBuilder;
...

// create a structure-builder
$structureBuilder = new StructureBuilder($commander);

// create a new structure
$structure = new Structure();

// add some blocks
// in this case build a sand tower that is five blocks high
for ($i = 0; $i < 5; $i++)
{
    $structure->createBlock('sand', array('x' => 1, 'y' => $i, 'z' => 1));
}

// add a row of 3 sand blocks on the Y axis
// starting on 1:1:1
$structure->addRow('y', 'sand', 3);

// build it on the server
$structureBuilder->build($structure);

```

Converting images to Structures
-------------------------------

[](#converting-images-to-structures)

To convert images to structures the imagick extension for PHP is required.

The example below will build a structure that is 5 blocks high, and is made of air and leaves. Every black pixel will be leaves every white pixel will be air. The structure will be placed on x -&gt; 33, z -&gt; 19

The result can be seen in this video:

```
$converter = new ImageToStructureConverter();
$converter->setBlackBlockType('leaves');
$converter->setWhiteBlockType('air');

$image     = new Imagick('test.png');
$structure = $converter->convert($image, 5);
$structureBuilder->build($structure,
    array('x' => '-33',
          'y' => '3',
          'z' => '19')
);

```

Saving structures for further use
---------------------------------

[](#saving-structures-for-further-use)

You can persist structures for later use using the StructureRepository. Currently this Repository uses a sqlite database to store the data by default, this behavior can be easily changed by creating a custom EntityManager by yourself and passing it to the StructureRepositoryFactory.

```
// bootstrap doctrine
$entityManager = require_once __DIR__ . '/bootstrap.php';

// create a repository
$factory = new StructureRepositoryFactory();
$repository = $factory->create($entityManager);

// create a new structure
$structure = new Structure();
$structure->createBlock('iron', array('x' => 1, 'y' => 1, 'z' => 1));
$structure->setName('greatness');

// save it to the database
$repository->add($structure);

// get it from the database
$repository->getByName('greatness');

```

Currently these Commands are available for the Commander
--------------------------------------------------------

[](#currently-these-commands-are-available-for-the-commander)

- say
- listPlayers
- locatePlayer
- teleport
- give
- setWeather
- setTime
- setBlock
- raw

Running the tests
-----------------

[](#running-the-tests)

```
bin/phpspec run

```

Contribute!
-----------

[](#contribute)

Feel free to give me feedback/feature-request/bug-reports via. github issues. Or just send me a pull-request :)

Author
------

[](#author)

- [Christoph Rosse](http://twitter.com/griesx)

License
-------

[](#license)

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Total

3

Last Release

4551d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/db7c27a0fae43ee96bc83d30f0801bfcb2033cd403f013fa8a5795ba7c846672?d=identicon)[gries](/maintainers/gries)

---

Top Contributors

[![gries](https://avatars.githubusercontent.com/u/417823?v=4)](https://github.com/gries "gries (117 commits)")[![BarryCarlyon](https://avatars.githubusercontent.com/u/20999?v=4)](https://github.com/BarryCarlyon "BarryCarlyon (1 commits)")

---

Tags

adminminecraft

### Embed Badge

![Health badge](/badges/gries-mcontrol/health.svg)

```
[![Health](https://phpackages.com/badges/gries-mcontrol/health.svg)](https://phpackages.com/packages/gries-mcontrol)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M464](/packages/pimcore-pimcore)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9417.2k55](/packages/open-dxp-opendxp)[contao/core-bundle

Contao Open Source CMS

1231.6M2.7k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
