PHPackages                             xpaw/php-source-query-class - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. xpaw/php-source-query-class

ActiveLibrary[Testing &amp; Quality](/categories/testing)

xpaw/php-source-query-class
===========================

PHP library to query and send RCON commands to servers based on "Source Engine Query" protocol

6.0.0(3mo ago)610189.9k—0%150[3 issues](https://github.com/xPaw/PHP-Source-Query/issues)6LGPL-2.1PHPPHP &gt;=8.2CI passing

Since Oct 6Pushed 2mo ago51 watchersCompare

[ Source](https://github.com/xPaw/PHP-Source-Query)[ Packagist](https://packagist.org/packages/xpaw/php-source-query-class)[ Docs](https://github.com/xPaw/PHP-Source-Query)[ GitHub Sponsors](https://github.com/sponsors/xPaw)[ RSS](/packages/xpaw-php-source-query-class/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (6)

PHP Source Query
================

[](#php-source-query)

[![Packagist Downloads](https://camo.githubusercontent.com/80fda599d9a56373ab8f081bb3276bc54647753236dd7c63cbffab4a0dd40f3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f787061772f7068702d736f757263652d71756572792d636c6173732e737667)](https://packagist.org/packages/xpaw/php-source-query-class)[![Packagist Version](https://camo.githubusercontent.com/7b4def2b2fa182bdc8dce8a6a0541540841efb071a7340f49693a68a3e4071d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f787061772f7068702d736f757263652d71756572792d636c6173732e737667)](https://packagist.org/packages/xpaw/php-source-query-class)

This class was created to query game server which use the Source query protocol, this includes all source games, and all the games that implement Steamworks.

The class also allows you to query servers using RCON although this only works for half-life 1 and source engine games.

[Minecraft](http://www.minecraft.net) also uses Source RCON protocol, and this means you can use this class to send commands to your minecraft server while having engine set to Source engine.

**⚠️ Do not send me emails if this does not work for you, I will not help you.**

Requirements
------------

[](#requirements)

- [Modern PHP version](https://php.net/supported-versions.php)
- 64-bit PHP or [gmp module](https://secure.php.net/manual/en/book.gmp.php)
- Your server must allow UDP connections

Protocol Specifications
-----------------------

[](#protocol-specifications)

- [https://developer.valvesoftware.com/wiki/Server\_queries](https://developer.valvesoftware.com/wiki/Server_queries)
- [https://developer.valvesoftware.com/wiki/Source\_RCON\_Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol)

Supported Games
---------------

[](#supported-games)

AppIDGameQueryRCONNotes~All HL1/HL2 games and mods✅✅10[Counter-Strike 1.6](http://store.steampowered.com/app/10/)✅✅440[Team Fortress 2](http://store.steampowered.com/app/440/)✅✅550[Left 4 Dead 2](http://store.steampowered.com/app/550/)✅✅730[Counter-Strike 2](http://store.steampowered.com/app/730/)✅✅`host_name_store 1; host_info_show 2; host_players_show 2`1002[Rag Doll Kung Fu](http://store.steampowered.com/app/1002/)✅✅2400[The Ship](http://store.steampowered.com/app/2400/)✅✅4000[Garry's Mod](http://store.steampowered.com/app/4000/)✅✅17710[Nuclear Dawn](http://store.steampowered.com/app/17710/)✅✅70000[Dino D-Day](http://store.steampowered.com/app/70000/)✅✅107410[Arma 3](http://store.steampowered.com/app/107410/)✅❌Add +1 to the server port115300[Call of Duty: Modern Warfare 3](http://store.steampowered.com/app/115300/)✅✅162107[DeadPoly](https://store.steampowered.com/app/1621070/)✅❌211820[Starbound](http://store.steampowered.com/app/211820/)✅✅Call `SetUseOldGetChallengeMethod` method after connecting244850[Space Engineers](http://store.steampowered.com/app/244850/)✅❌Add +1 to the server port304930[Unturned](https://store.steampowered.com/app/304930/)✅❌Add +1 to the server port251570[7 Days to Die](http://store.steampowered.com/app/251570)✅❌252490[Rust](http://store.steampowered.com/app/252490/)✅❌282440[Quake Live](http://store.steampowered.com/app/282440)✅❌Quake Live uses the ZMQ messaging queue protocol for rcon control.346110[ARK: Survival Evolved](http://store.steampowered.com/app/346110/)✅✅~[Minecraft](http://www.minecraft.net/)❌✅108600[Project: Zomboid](https://store.steampowered.com/app/108600/)✅✅1874880[Arma Reforger](https://store.steampowered.com/app/1874880/)✅✅Open a pull request if you know another game which supports Source Query and/or RCON protocols.

How to tell if the game supports Source Query Protocol?
-------------------------------------------------------

[](#how-to-tell-if-the-game-supports-source-query-protocol)

Add your server to your favourites in Steam server browser, and if Steam can display information about your server, then the protocol is supported.

Functions
---------

[](#functions)

  Connect( $Ip, $Port, $Timeout, $Engine ) Opens connection to a server   Disconnect( ) Closes all open connections   Ping( ) Ping the server to see if it exists
**Warning:** Source engine may not answer to this   GetInfo( ) Returns server info in an array   GetPlayers( ) Returns players on the server in an array   GetRules( ) Returns public rules *(cvars)* in an array   SetRconPassword( $Password ) Sets rcon password for later use with *Rcon()*   Rcon( $Command ) Execute rcon command on the server Also refer to [examples folder](Examples/) to work things out.

License
-------

[](#license)

```
PHP Source Query
Copyright (C) 2012-2025 Pavel Djundik

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

```

###  Health Score

68

—

FairBetter than 100% of packages

Maintenance84

Actively maintained with recent releases

Popularity57

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 91.3% 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 ~538 days

Recently: every ~470 days

Total

8

Last Release

110d ago

Major Versions

1.0.0 → 2.0.02020-12-03

2.1.0 → 3.0.02023-09-25

3.0.0 → 4.0.02024-08-04

4.0.0 → 5.0.02025-09-28

5.0.0 → 6.0.02026-01-29

PHP version history (5 changes)0.1.0PHP &gt;=5.4

2.0.0PHP &gt;=7.4

3.0.0PHP &gt;=8.0

4.0.0PHP &gt;=8.1

6.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e0942af20ff43fb658f834cff0348fe0b2c5d153b7fa9bef0938591edba13fe?d=identicon)[xPaw](/maintainers/xPaw)

---

Top Contributors

[![xPaw](https://avatars.githubusercontent.com/u/613331?v=4)](https://github.com/xPaw "xPaw (188 commits)")[![ihasTaco](https://avatars.githubusercontent.com/u/77412945?v=4)](https://github.com/ihasTaco "ihasTaco (3 commits)")[![Kubo2](https://avatars.githubusercontent.com/u/6882599?v=4)](https://github.com/Kubo2 "Kubo2 (2 commits)")[![msjyoo](https://avatars.githubusercontent.com/u/2097812?v=4)](https://github.com/msjyoo "msjyoo (2 commits)")[![koshatul](https://avatars.githubusercontent.com/u/106480?v=4)](https://github.com/koshatul "koshatul (1 commits)")[![Mechtecs](https://avatars.githubusercontent.com/u/5622125?v=4)](https://github.com/Mechtecs "Mechtecs (1 commits)")[![mizantrop777](https://avatars.githubusercontent.com/u/30718125?v=4)](https://github.com/mizantrop777 "mizantrop777 (1 commits)")[![Sieberkev](https://avatars.githubusercontent.com/u/3216851?v=4)](https://github.com/Sieberkev "Sieberkev (1 commits)")[![tatupesonen](https://avatars.githubusercontent.com/u/7150217?v=4)](https://github.com/tatupesonen "tatupesonen (1 commits)")[![timmw](https://avatars.githubusercontent.com/u/367327?v=4)](https://github.com/timmw "timmw (1 commits)")[![cmathews393](https://avatars.githubusercontent.com/u/23042980?v=4)](https://github.com/cmathews393 "cmathews393 (1 commits)")[![zavg](https://avatars.githubusercontent.com/u/890579?v=4)](https://github.com/zavg "zavg (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![Hackmastr](https://avatars.githubusercontent.com/u/9281515?v=4)](https://github.com/Hackmastr "Hackmastr (1 commits)")[![InvexByte](https://avatars.githubusercontent.com/u/25399962?v=4)](https://github.com/InvexByte "InvexByte (1 commits)")

---

Tags

phpphpunitrconsource-enginesource-gamessteamminecraftrustrconcounter-strikecsgoteam fortressstarboundarkgmod

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xpaw-php-source-query-class/health.svg)

```
[![Health](https://phpackages.com/badges/xpaw-php-source-query-class/health.svg)](https://phpackages.com/packages/xpaw-php-source-query-class)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[instaclick/php-webdriver

PHP WebDriver for Selenium 2

43661.8M22](/packages/instaclick-php-webdriver)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69617.9M510](/packages/spatie-phpunit-snapshot-assertions)[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3287.8M898](/packages/szepeviktor-phpstan-wordpress)[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14327.7M294](/packages/dms-phpunit-arraysubset-asserts)

PHPackages © 2026

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