Download the PHP package gries/mcontrol without Composer

On this page you can find all versions of the php package gries/mcontrol. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mcontrol

MControl

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

SensioLabsInsight

Build Status

Installation

MControl can be installed via. Composer:

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

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

....
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

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 -> 33, z -> 19

The result can be seen in this video: https://vimeo.com/79598411

$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

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

Running the tests

bin/phpspec run

Contribute!

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

Author

License

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


All versions of mcontrol with dependencies

PHP Build Version
Package Version
Requires monolog/monolog Version ~1.6
doctrine/orm Version ~2.4
gries/php-source-query-class Version dev-master
symfony/dom-crawler Version ~2.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gries/mcontrol contains the following files

Loading the files please wait ....