xpaw/php-source-query-class
Composer 安装命令:
composer require xpaw/php-source-query-class
包简介
PHP library to query and send RCON commands to servers based on "Source Engine Query" protocol
README 文档
README
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 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
- Modern PHP version
- 64-bit PHP or gmp module
- Your server must allow UDP connections
Protocol Specifications
- https://developer.valvesoftware.com/wiki/Server_queries
- https://developer.valvesoftware.com/wiki/Source_RCON_Protocol
Supported Games
| AppID | Game | Query | RCON | Notes |
|---|---|---|---|---|
| ~ | All HL1/HL2 games and mods | ✅ | ✅ | |
| 10 | Counter-Strike 1.6 | ✅ | ✅ | |
| 440 | Team Fortress 2 | ✅ | ✅ | |
| 550 | Left 4 Dead 2 | ✅ | ✅ | |
| 730 | Counter-Strike 2 | ✅ | ✅ | host_name_store 1; host_info_show 2; host_players_show 2 |
| 1002 | Rag Doll Kung Fu | ✅ | ✅ | |
| 2400 | The Ship | ✅ | ✅ | |
| 4000 | Garry's Mod | ✅ | ✅ | |
| 17710 | Nuclear Dawn | ✅ | ✅ | |
| 70000 | Dino D-Day | ✅ | ✅ | |
| 107410 | Arma 3 | ✅ | ❌ | Add +1 to the server port |
| 115300 | Call of Duty: Modern Warfare 3 | ✅ | ✅ | |
| 162107 | DeadPoly | ✅ | ❌ | |
| 211820 | Starbound | ✅ | ✅ | Call SetUseOldGetChallengeMethod method after connecting |
| 244850 | Space Engineers | ✅ | ❌ | Add +1 to the server port |
| 304930 | Unturned | ✅ | ❌ | Add +1 to the server port |
| 251570 | 7 Days to Die | ✅ | ❌ | |
| 252490 | Rust | ✅ | ❌ | |
| 282440 | Quake Live | ✅ | ❌ | Quake Live uses the ZMQ messaging queue protocol for rcon control. |
| 346110 | ARK: Survival Evolved | ✅ | ✅ | |
| ~ | Minecraft | ❌ | ✅ | |
| 108600 | Project: Zomboid | ✅ | ✅ | |
| 1874880 | Arma Reforger | ✅ | ✅ |
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?
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
| 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 to work things out.
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
xpaw/php-source-query-class 适用场景与选型建议
xpaw/php-source-query-class 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 204.32k 次下载、GitHub Stars 达 610, 最近一次更新时间为 2015 年 02 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rcon」 「minecraft」 「counter-strike」 「csgo」 「team fortress」 「starbound」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 xpaw/php-source-query-class 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xpaw/php-source-query-class 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 xpaw/php-source-query-class 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
RCON Library for game servers management
Allow users to use the head of a Minecraft skin as avatar.
The library is designed to integrate the minecraft server with the website.
PHP library to request RCON for Minecraft servers
PHP RCON Client
PHP library retrieve game servers status from various types of games.
统计信息
- 总下载量: 204.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 614
- 点击次数: 36
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: LGPL-2.1
- 更新时间: 2015-02-01