PHPackages                             dsg/squad-rcon-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dsg/squad-rcon-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dsg/squad-rcon-php
==================

Squad Server RCon library

4.0.0(3y ago)32.3k[2 PRs](https://github.com/Deutsche-Squad-Gemeinschaft/squad-rcon-php/pulls)MITPHPCI passing

Since Mar 21Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Deutsche-Squad-Gemeinschaft/squad-rcon-php)[ Packagist](https://packagist.org/packages/dsg/squad-rcon-php)[ RSS](/packages/dsg-squad-rcon-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (37)Used By (0)

 [![Squad RCON PHP Logo](https://raw.githubusercontent.com/Deutsche-Squad-Gemeinschaft/squad-rcon-php/master/logo.svg)](https://raw.githubusercontent.com/Deutsche-Squad-Gemeinschaft/squad-rcon-php/master/logo.svg)

Squad RCON PHP
==============

[](#squad-rcon-php)

 **RCON PHP wrapper for Squad server management**

---

 [ ![Deutsche Squad Gemeinschaft](https://github.com/Deutsche-Squad-Gemeinschaft/squad-rcon-php/workflows/CI/badge.svg) ](https://github.com/Deutsche-Squad-Gemeinschaft/squad-rcon-php/actions) [ ![Deutsche Squad Gemeinschaft](https://camo.githubusercontent.com/e58bce33ecececfb46470570d81c50ee70cf0bf966fc09aa50967b3de1eb553d/68747470733a2f2f636f6465636f762e696f2f67682f44657574736368652d53717561642d47656d65696e7363686166742f73717561642d72636f6e2d7068702f6272616e63682f6d61737465722f67726170682f62616467652e737667) ](https://codecov.io/gh/Deutsche-Squad-Gemeinschaft/squad-rcon-php) [ ![Total Downloads](https://camo.githubusercontent.com/f31eebbaa42b6e07d99c0826cb37bf8b8de49387bfd904feeaec94a70eb45ea2/68747470733a2f2f706f7365722e707567782e6f72672f6473672f73717561642d72636f6e2d7068702f646f776e6c6f6164732e706e67) ](https://packagist.org/packages/dsg/squad-rcon-php) [ ![Latest Stable Version](https://camo.githubusercontent.com/7a5658decdd2decb9b0baf7804503ad6692f402a17f0222577a9a00a4569cad2/68747470733a2f2f706f7365722e707567782e6f72672f6473672f73717561642d72636f6e2d7068702f762f737461626c65) ](https://packagist.org/packages/dsg/squad-rcon-php) [ ![Latest Unstable Version](https://camo.githubusercontent.com/d7f30ea76fff55862e2f2e511242fca02fce77167113b238b8deb79d7ae8118a/68747470733a2f2f706f7365722e707567782e6f72672f6473672f73717561642d72636f6e2d7068702f762f756e737461626c65) ](https://packagist.org/packages/dsg/squad-rcon-php) [ ![License](https://camo.githubusercontent.com/7e243c1d5b50acf09c0bc2ff00e0098d5e3649bc691ef4e360b5c0983b6e8d75/68747470733a2f2f706f7365722e707567782e6f72672f6473672f73717561642d72636f6e2d7068702f6c6963656e7365) ](https://packagist.org/packages/dsg/squad-rcon-php)
 [ ![Deutsche Squad Gemeinschaft](https://raw.githubusercontent.com/Deutsche-Squad-Gemeinschaft/battlemetrics-php/master/dsg-badge.svg) ](https://dsg-gaming.de) [ ![Discord](https://camo.githubusercontent.com/72a9c5ed48d13e8627ab2fd07e55bb22f6423fb3186c0f875f43765656c8a169/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3236363231303232333430363937323932382e7376673f7374796c653d666c61742d737175617265266c6f676f3d646973636f7264) ](https://discord.gg/9F2Ng5C)

Join the Squad RCON Community
-----------------------------

[](#join-the-squad-rcon-community)

If you have any questions or need help with getting started with RCON in OWI games you should make sure to join the [Squad RCON Community on Discord](https://discord.gg/9F2Ng5C).

Installation
------------

[](#installation)

You can install this package by using composer and the following command:

```
composer require dsg/squad-rcon-php

```

The code will then be available under the `DSG\SquadRCON` namespace.

Commands
--------

[](#commands)

- ListPlayers
- ListSquads
- AdminListDisconnectedPlayers
- ShowCurrentMap
- ShowNextMap
- AdminKick "&lt;NameOrSteamId&gt;" &lt;KickReason&gt;
- AdminKickById &lt;PlayerId&gt; &lt;KickReason&gt;
- AdminBan "&lt;NameOrSteamId&gt;" "&lt;BanLength&gt;" &lt;BanReason&gt;
- AdminBanById &lt;PlayerId&gt; "&lt;BanLength&gt;" &lt;BanReason&gt;
- AdminBroadcast &lt;Message&gt;
- AdminRestartMatch
- AdminEndMatch
- AdminChangeLevel &lt;LevelName&gt;
- AdminSetNextLevel &lt;LevelName&gt;
- AdminChangeLayer &lt;LayerName&gt;
- AdminSetNextLayer &lt;LayerName&gt;
- AdminSetMaxNumPlayers &lt;NumPlayers&gt;
- AdminSetServerPassword &lt;Password&gt;
- AdminSlomo &lt;TimeDilation&gt;
- AdminForceTeamChange &lt;NameOrSteamId&gt;
- AdminForceTeamChangeById &lt;PlayerId&gt;
- AdminDemoteCommander &lt;PlayerName&gt;
- AdminDemoteCommanderById &lt;PlayerId&gt;
- AdminDisbandSquad &lt;TeamId&gt; &lt;SquadId&gt;
- AdminRemovePlayerFromSquad &lt;PlayerName&gt;
- AdminRemovePlayerFromSquadById &lt;PlayerId&gt;
- AdminWarn &lt;NameOrSteamId&gt; &lt;WarnReason&gt;
- AdminWarnById &lt;PlayerId&gt; &lt;WarnReason&gt;
- AdminVoteLevel &lt;Choices, concatenated by +&gt;
- AdminVoteLayer &lt;Choices, concatenated by +&gt;
- AdminVoteNextLevel &lt;Choices, concatenated by +&gt;
- AdminVoteNextLayer &lt;Choices, concatenated by +&gt;
- AdminVote &lt;Vote name&gt; &lt;Choices, concatenated by +&gt;

USAGE
-----

[](#usage)

### Create an instance

[](#create-an-instance)

Instanciate the SquadServer class to open a new RCON connection. This will throw an Exception if no connection can be made.

```
use DSG\SquadRCON\SquadServer;

...

/** @var SquadServer */
$server = new SquadServer(new ServerConnectionInfo(
    host: '127.0.0.1',
    port: 21114,
    password: 'YourRconPassword'
));
```

### Get current server population (Teams, Squads, Players)

[](#get-current-server-population-teams-squads-players)

Get the current population. This does use ListPlayers &amp; ListSquads to get the Teams, Squads and Players properly ordered.

```
/** @var Population */
$population = $server->serverPopulation();

/** @var Team[] */
$teams = $population->getTeams();

foreach ($teams as $team) {
    $name = $team->getName();

    foreach ($team->getSquads() as $squad) {
        $creatorName = $squad->getCreatorName();
        $creatorSteamId = $squad->getCreatorSteamId();

        foreach ($squad->getPlayers() as $player) {
            $name = $player->getName();
            $steamId = $player->getSteamId();
        }
    }

    foreach ($team->getPlayers() as $unassigned) {
        $name = $player->getName();
        $steamId = $player->getSteamId();
    }
}

// or

/** @var Player[] */
$players = $population->getPlayers();

// or

/** @var Player|null */
$player = $population->getPlayerBySteamId('76561197960287930');
```

### ListPlayers

[](#listplayers)

Get the current Player list using the ListPlayers command. This does not include disconnected players.

```
/** @var Player[] */
$players = $server->listPlayers();
```

### Get disconnected Players

[](#get-disconnected-players)

Get disconnected players using the ListPlayers command.

```
/** @var Player[] */
$players = $server->listDisconnectedPlayers();
```

### ListSquads

[](#listsquads)

Get currently active squads (and teams)

```
/** @var Team[] */
$teams = $server->listSquads();
```

### AdminKick

[](#adminkick)

Kick a player by name, SteamId or ingame id.

```
/** @var bool */
$success = $server->adminKick('76561197960287930', 'Reason');

// or

/** @var bool */
$success = $server->adminKickById($player->getId(), 'Reason');
```

### AdminBan

[](#adminban)

Ban a player by name, SteamId or ingame id.

```
/** @var bool */
$success = $server->adminBan('76561197960287930', '1h', 'Reason');

// or

/** @var bool */
$success = $server->adminBanById($player->getId(), '1h', 'Reason');
```

### Get the current map

[](#get-the-current-map)

Get the current map using the ShowNextMap command

```
/** @var array */
$map = $server->showCurrentMap();
echo $map['level'];
echo $map['layer'];
```

### Get the next map

[](#get-the-next-map)

Get the next map using the ShowNextMap command

```
/** @var array */
$map = $server->showNextMap();
echo $map['level'];
echo $map['layer'];
```

### AdminRestartMatch

[](#adminrestartmatch)

Restart the current match

```
/** @var bool */
$success = $server->adminRestartMatch();
```

### AdminEndMatch

[](#adminendmatch)

End the current match

```
/** @var bool */
$success = $server->adminEndMatch();
```

### AdminBroadcast

[](#adminbroadcast)

Broadcast message to all players on the server

```
/** @var bool */
$success = $server->adminBroadcast('Hello from the other side');
```

### AdminChangeLevel

[](#adminchangelevel)

Change the level ( and pick a random layer on it) and travel to it immediately

```
/** @var bool */
$success = $server->adminChangeLevel('Sumari');
```

### AdminSetNextLevel

[](#adminsetnextlevel)

Set the next Level ( and pick a random layer on it) to travel to after this match ends

```
/** @var bool */
$success = $server->adminSetNextLevel('Sumari');
```

### AdminChangeLayer

[](#adminchangelayer)

Change the layer and travel to it immediately

```
/** @var bool */
$success = $server->adminChangeLayer('Sumari AAS v1');
```

### AdminSetNextLayer

[](#adminsetnextlayer)

Set the next layer to travel to after this match ends

```
/** @var bool */
$success = $server->adminSetNextLayer('Sumari AAS v1');
```

### AdminSetMaxNumPlayers

[](#adminsetmaxnumplayers)

Set the maximum amount of players / slots

```
/** @var bool */
$success = $server->adminSetMaxNumPlayers(80);
```

### AdminSetServerPassword

[](#adminsetserverpassword)

Set the server password

```
/** @var bool */
$success = $server->adminSetServerPassword('secret');
```

### AdminSlomo

[](#adminslomo)

Sets the game speed with the AdminSlomo. Default 1.0

```
/** @var bool */
$success = $server->adminSlomo(1.5);
```

### AdminForceTeamChange

[](#adminforceteamchange)

Forces a player to the opposite team by providing the name or steamid.

```
/** @var bool */
$success = $server->adminForceTeamChange('Name or SteamId');
```

### AdminForceTeamChangeById

[](#adminforceteamchangebyid)

Forces a player to the opposite team by providing the ingame Player id.

```
/** @var bool */
$success = $server->adminForceTeamChangeById($player->getId());
```

### AdminDisbandSquad command.

[](#admindisbandsquad-command)

Disbands a Squad by providing the Team id / index &amp; Squad id / index.

```
/** @var bool */
$success = $server->adminDisbandSquad($team->getId(), $squad->getId());
```

### AdminRemovePlayerFromSquad

[](#adminremoveplayerfromsquad)

Removes a Player from his Squad by providing the Player name.

```
/** @var bool */
$success = $server->adminRemovePlayerFromSquad('Name');
```

### AdminRemovePlayerFromSquadById

[](#adminremoveplayerfromsquadbyid)

Removes a player from his Squad by providing the ingame Player id.

```
/** @var bool */
$success = $server->adminRemovePlayerFromSquadById($player->getId());
```

### AdminWarn

[](#adminwarn)

Warns a Player by providing his name / steamid and a message.

```
/** @var bool */
$success = $server->adminWarn('Name or SteamId', 'Warn Reason');
```

### AdminWarnById

[](#adminwarnbyid)

Warns a Player by id.

```
/** @var bool */
$success = $server->adminWarnById($player->getId(), 'Warn Reason');
```

Important Note
--------------

[](#important-note)

Make sure to always close the connection manually or trigger a disconnect by destructing the object to preventt blocking the RCON server by using up it'S available connections.

```
$server->disconnect();
// Or
unset($server);
```

Special Thanks
--------------

[](#special-thanks)

- [SquadSlovenia](https://github.com/SquadSlovenia) (Intial creators)
- [Brozowski](https://github.com/Brozowski) (Major contributor)
- \[ToG\] subtlerod (Major contributions to the used SquadRcon implementation)
- [Thomas Smyth](https://github.com/Thomas-Smyth/SquadJS) (Creator of SquadJS, a great resource for Squad RCON).

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance54

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 89.8% 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 ~36 days

Recently: every ~91 days

Total

25

Last Release

1365d ago

Major Versions

0.3.0 → 1.0.02020-09-22

1.0.0 → 2.0.02021-02-26

2.0.1 → 3.0.02021-04-16

3.3.0 → 4.0.02022-08-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/509a5baf8d7d8f7ae8c5b569ee81b1d04ed6af1af625696777e51e997ff9a685?d=identicon)[bumbummen99](/maintainers/bumbummen99)

---

Top Contributors

[![bumbummen99](https://avatars.githubusercontent.com/u/4533331?v=4)](https://github.com/bumbummen99 "bumbummen99 (79 commits)")[![SquadSlovenia](https://avatars.githubusercontent.com/u/23271091?v=4)](https://github.com/SquadSlovenia "SquadSlovenia (6 commits)")[![Brozowski](https://avatars.githubusercontent.com/u/15922579?v=4)](https://github.com/Brozowski "Brozowski (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

hacktoberfestphprconsquad

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dsg-squad-rcon-php/health.svg)

```
[![Health](https://phpackages.com/badges/dsg-squad-rcon-php/health.svg)](https://phpackages.com/packages/dsg-squad-rcon-php)
```

###  Alternatives

[moderntribe/tribe-libs

A library for use on Modern Tribe service projects.

1348.8k2](/packages/moderntribe-tribe-libs)

PHPackages © 2026

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