Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

nathan818fr/php-minecraft-pinger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Minecraft Pinger

Ping minecraft PC servers from PHP. Support Minecraft 1.7+ (works with Spigot, Bukkit, ...).

Installation

This library is published on packagist.org, so you can add it to your composer.json file for an easy installation:

composer require nathan818/php-minecraft-pinger

Example

Ping a server:

<?php
include(__DIR__ . '/vendor/autoload.php');

use MinecraftPinger\MinecraftPinger;
use MinecraftPinger\MinecraftPingException;

$pinger = new MinecraftPinger('mc.hypixel.net', 25565); // Port is optional
try
{
    $pingResponse = $pinger->ping();
    echo 'There are ' . $pingResponse->players->online . ' players online on Hypixel!' . "\n";
}
catch (MinecraftPingException $e)
{
    // An error has occurred
    echo $e->getMessage();
}

About

Ping minecraft PC servers from PHP.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages