{"id":15409485,"url":"https://github.com/xpaw/php-minecraft-query","last_synced_at":"2025-05-14T02:07:18.624Z","repository":{"id":1634321,"uuid":"2358487","full_name":"xPaw/PHP-Minecraft-Query","owner":"xPaw","description":"🐘 PHP library to query Minecraft servers","archived":false,"fork":false,"pushed_at":"2024-10-18T10:18:17.000Z","size":108,"stargazers_count":729,"open_issues_count":4,"forks_count":199,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-05-13T04:42:00.323Z","etag":null,"topics":["bedrock","mcpe","minecraft","php","raknet"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/xpaw/php-minecraft-query","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ibdknox/crate","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xPaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-09-09T22:27:32.000Z","updated_at":"2025-04-22T08:32:18.000Z","dependencies_parsed_at":"2024-01-16T09:53:05.761Z","dependency_job_id":"b53cfaf6-28f0-4566-84fc-be8aa4ac75be","html_url":"https://github.com/xPaw/PHP-Minecraft-Query","commit_stats":{"total_commits":111,"total_committers":20,"mean_commits":5.55,"dds":0.6846846846846847,"last_synced_commit":"b522ec62b6cfe6c3397dd9034b422caaa3219f9d"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xPaw%2FPHP-Minecraft-Query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xPaw%2FPHP-Minecraft-Query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xPaw%2FPHP-Minecraft-Query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xPaw%2FPHP-Minecraft-Query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xPaw","download_url":"https://codeload.github.com/xPaw/PHP-Minecraft-Query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052802,"owners_count":22006717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bedrock","mcpe","minecraft","php","raknet"],"created_at":"2024-10-01T16:40:14.317Z","updated_at":"2025-05-14T02:07:13.613Z","avatar_url":"https://github.com/xPaw.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Minecraft Query [![Packagist](https://img.shields.io/packagist/dt/xpaw/php-minecraft-query.svg)](https://packagist.org/packages/xpaw/php-minecraft-query)\n\nThis library can be used to query Minecraft servers for some basic information.\n\n**:warning: Please do not create issues when you are unable to retrieve information from a server, unless you can prove that there is a bug within the library.**\n\n## Differences between Ping and Query\n\nThere are two methods of retrieving information about a Minecraft server.\n\n### Ping\nPing protocol was added in Minecraft 1.7 and is used to query the server for minimal amount of information (hostname, motd, icon, and a sample of players). This is easier to use and doesn't require extra setup on server side. It uses TCP protocol on the same port as you would connect to your server.\n\n`MinecraftPing` class contains a method `QueryOldPre17` which can be used to query servers on version 1.6 or older.\n\n### Query\nThis method uses GameSpy4 protocol, and requires enabling `query` listener in your `server.properties` like this:\n\n\u003e *enable-query=true*\u003cbr\u003e\n\u003e *query.port=25565*\n\nQuery allows to request a full list of servers' plugins and players, however this method is more prone to breaking, so if you don't need all this information, stick to the ping method as it's more reliable.\n\n## RCON\nIt is possible to send console commands to a Minecraft server remotely using the [Source RCON protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol). Use [PHP Source Query](https://github.com/xPaw/PHP-Source-Query-Class) library for your RCON needs.\n\n## SRV DNS record\nThis library automatically tries to resolve SRV records. If you do not wish to do so, pass `false` as the fourth param in the constructor (after timeout param).\n\n## Example\n```php\n\u003c?php\n\trequire __DIR__ . '/src/MinecraftPing.php';\n\trequire __DIR__ . '/src/MinecraftPingException.php';\n\t\n\tuse xPaw\\MinecraftPing;\n\tuse xPaw\\MinecraftPingException;\n\t\n\ttry\n\t{\n\t\t$Query = new MinecraftPing( 'localhost', 25565 );\n\t\t\n\t\tprint_r( $Query-\u003eQuery() );\n\t}\n\tcatch( MinecraftPingException $e )\n\t{\n\t\techo $e-\u003egetMessage();\n\t}\n\tfinally\n\t{\n\t\tif( $Query )\n\t\t{\n\t\t\t$Query-\u003eClose();\n\t\t}\n\t}\n?\u003e\n```\n\nIf you want to get `ping` info from a server that uses a version older than Minecraft 1.7,\nthen use function `QueryOldPre17` instead of `Query`.\n\n----\n\nIf the server has query enabled (`enable-query`), then you can use `MinecraftQuery` to more retrieve information about a server.\n```php\n\u003c?php\n\trequire __DIR__ . '/src/MinecraftQuery.php';\n\trequire __DIR__ . '/src/MinecraftQueryException.php';\n\t\n\tuse xPaw\\MinecraftQuery;\n\tuse xPaw\\MinecraftQueryException;\n\t\n\t$Query = new MinecraftQuery( );\n\t\n\ttry\n\t{\n\t\t$Query-\u003eConnect( 'localhost', 25565 );\n\t\t\n\t\tprint_r( $Query-\u003eGetInfo( ) );\n\t\tprint_r( $Query-\u003eGetPlayers( ) );\n\t}\n\tcatch( MinecraftQueryException $e )\n\t{\n\t\techo $e-\u003egetMessage( );\n\t}\n?\u003e\n```\n\nFor Bedrock servers (MCPE) use `ConnectBedrock` function instead of `Connect`, then `GetInfo` will work.\n\n## License\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpaw%2Fphp-minecraft-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpaw%2Fphp-minecraft-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpaw%2Fphp-minecraft-query/lists"}