PHPackages                             nizarii/arma-rcon-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. [API Development](/categories/api)
4. /
5. nizarii/arma-rcon-class

ActiveLibrary[API Development](/categories/api)

nizarii/arma-rcon-class
=======================

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your BattlEye server, including Arma 3, Arma 2 and Arma 2: OA game servers.

2.2.3(4y ago)453.9k↑71.4%19[2 issues](https://github.com/felixms/arma-rcon-class-php/issues)MITPHPPHP &gt;=5.4.0

Since May 11Pushed 4y ago11 watchersCompare

[ Source](https://github.com/felixms/arma-rcon-class-php)[ Packagist](https://packagist.org/packages/nizarii/arma-rcon-class)[ Docs](https://github.com/Nizarii/arma-rcon-class-php/)[ RSS](/packages/nizarii-arma-rcon-class/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (16)Used By (0)

Arma RCon Class (ARC) 2.2 for PHP
=================================

[](#arma-rcon-class-arc-22-for-php)

[![Codacy Badge](https://camo.githubusercontent.com/763ab752f0b414ebbbf860c23e70b619661bda82486962912bfc99f168c9e7a6/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6634326435306139363933623466656262333466616233663638333135333635)](https://www.codacy.com/app/nizari/arma-rcon-class-php?utm_source=github.com&utm_medium=referral&utm_content=Nizarii/arma-rcon-class-php&utm_campaign=Badge_Grade)[![Packagist Version](https://camo.githubusercontent.com/64a3c7ef2706ebddc29d2a3b4e8cb6bf0cd02fce226f3594cb7d066f7a374736/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e697a617269692f61726d612d72636f6e2d636c6173732e737667)](https://packagist.org/packages/nizarii/arma-rcon-class)[![GitHub License](https://camo.githubusercontent.com/0d82406531dcdeda59f8b7957793daebfe91314e24bdae67f5d3fa5ea95d701b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e697a617269692f61726d612d72636f6e2d636c6173732d7068702e737667)](https://github.com/Nizarii/arma-rcon-class-php/)

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your **BattlEye** server, including **Arma 3**, **Arma 2** and **Arma 2: OA** game servers.

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

[](#requirements)

ARC 2.2 only requires **PHP 5.4** or higher!

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

[](#installation)

#### Via Composer *(recommended)*

[](#via-composer-recommended)

If you haven't already, download Composer.

```
$ curl -s http://getcomposer.org/installer | php
```

Now require and install ARC.

```
$ composer require nizarii/arma-rcon-class
$ composer install
```

#### Without Composer

[](#without-composer)

Choose a [release](https://github.com/Nizarii/arma-rcon-class-php/releases) and include ARC in your project: `require_once 'arc.php';`.

Examples
--------

[](#examples)

#### Getting started

[](#getting-started)

After installing ARC, you can easily use ARC as shown below. It will *automatically* establish a new connection and authenticate.

```
use \Nizarii\ARC;

$rcon = new ARC(string $ServerIP, string $RConPassword [, int $Port = 2302 [, array $Options = array()]]);
```

You are able to send commands with the `command()` function.

```
//...
$rcon->command('YourCommand');
```

ARC will throw an `Exception` if anything goes wrong. You might want to wrap your code in a *try catch block*.

```
use \Nizarii\ARC;

try {
    $rcon = new ARC('127.0.0.1', 'password');

    $array = $rcon->getPlayersArray();

    $rcon
        ->sayGlobal('example')
        ->kickPlayer(1, 'example')
        ->sayPlayer(0, 'example')
        ->disconnect()
    ;

    $rcon->getBans(); // Throws exception, because the connection was closed
} catch (Exception $e) {
    echo "Ups! Something went wrong: {$e->getMessage()}";
}
```

*Please consider that ARC only checks whether the command has been **successfully sent** via the socket to the server. It **does not** check if the command has been **executed** by the server.*

#### Options

[](#options)

Options can be passed to ARC as an array via the fourth parameter of the constructor. The following options are currently available:

- `int timeoutSec = 1`: Sets a timeout value on the connection.
- `bool autosavebans = false`: Automatically saves bans.txt after a player is banned or unbanned.
- `bool debug = false` : turns on debug mode, only works on "socketLoop()" and "socketLoopClose()"

*Suggestions for new options are always welcome!* 👍

**Basic usage:**

```
use \Nizarii\ARC;

$rcon = new ARC('127.0.0.1', 'RConPassword', 2322, [
    'timeoutSec' => 2
]);

//...
```

Functions
---------

[](#functions)

ARC features many functions to send BattlEye commands easier. After creating a new connections as explained above, you are able to use any of these functions:

- `string command(string $command)`: Sends any command to the BattlEye server.
- `string getPlayers()`: Returns a list with all players, which are currently on the server.
- `array getPlayersArray()`: Same as "getPlayers()", but formats the list to an array.
- `string getMissions()`: Gets a list of the available missions on the server.
- `string getBans()`: Gets a list of all BE server bans.
- `array getBansArray()`: Gets an array of all bans.
- `object kickPlayer(int $player [, string $reason = 'Admin Kick'])`: Kicks a player who is currently on the server.
- `object sayGlobal(string $message)`: Sends a global message to all players.
- `object sayPlayer(int $player, string $message)`: Sends a message to a specific player.
- `object loadScripts()`: Loads the "scripts.txt" file without the need to restart the server.
- `object maxPing(int $ping)`: Changes the MaxPing value. If a player has a higher ping, he will be kicked from the server.
- `object changePassword(string $password)`: Changes RCon password.
- `object loadBans()`: (Re)loads the BE ban list from "bans.txt".
- `object banPlayer(string $player [, string $reason = 'Banned' [, int $time = 0]])`: Ban a player's BE GUID from the server (If the time is 0, the ban will be permanent).
- `object addBan(string $player [, string $reason = 'Banned' [, int $time = 0]])`: Same as "banPlayer()", but allows to ban a player that is not currently on the server.
- `object removeBan(int $banid)`: Removes a ban.
- `object writeBans()`: Removes expired bans from the bans file.
- `object getBEServerVersion()`: Gets the current version of the BE server.
- `disconnect()`: Closes the current connection.
- `object reconnect()`: Closes the current connection &amp; creates a new one.
- `resource getSocket()`: Get the socket, which is used by ARC to send commands to the server.
- `boolean socketLoop(int $loop = -1)`: Get constant socket stream. $loop is the number of loops to be run until exiting the method. Note that the sequence will be reset. Set to infinite looping by default.
- `boolean socketLoopClose(int $loop = -1)`: Similar as "socketLoop()", but disconnects after looping. Set to infinite looping by default.
- `array readPackageRaw(string $msg)`: Make BettlEye format package readable for your program. Use $msg with unreadable header and unmodified string. Array will start as \[0\] =&gt; "FF" when having correct header. Array value \[1\] has important information what kind of care it needs for your connection. For more information, click [here](https://www.battleye.com/downloads/BERConProtocol.txt "BattlEye RCon Protocol Specification").

*See [here](https://community.bistudio.com/wiki/BattlEye#RCon_commands "BattlEye Wiki") for more information about BattlEye commands*

Contributors
------------

[](#contributors)

Thanks to all contributors for submitting issues and contributing code, including:

- @nerdalertdk
- @steffalon

*New contributors are always welcome ❤️*

License
-------

[](#license)

ARC is licensed under the **MIT License**. View `LICENSE` file for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~142 days

Recently: every ~388 days

Total

14

Last Release

1805d ago

Major Versions

1.3.6 → 2.1.12016-06-03

1.3.7 → 2.1.52017-02-28

PHP version history (2 changes)2.0PHP &gt;=5.3.0

2.1PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f187abd23a1ec9288a81e029aef679068bb42739833ee8070b73f96c0eb1fb22?d=identicon)[nizarii](/maintainers/nizarii)

---

Top Contributors

[![felixms](https://avatars.githubusercontent.com/u/14844186?v=4)](https://github.com/felixms "felixms (14 commits)")[![steffalon](https://avatars.githubusercontent.com/u/20344094?v=4)](https://github.com/steffalon "steffalon (9 commits)")[![nerdalertdk](https://avatars.githubusercontent.com/u/3426495?v=4)](https://github.com/nerdalertdk "nerdalertdk (7 commits)")[![scsmncao](https://avatars.githubusercontent.com/u/7018790?v=4)](https://github.com/scsmncao "scsmncao (3 commits)")[![Rexeh](https://avatars.githubusercontent.com/u/5183487?v=4)](https://github.com/Rexeh "Rexeh (2 commits)")[![cat24max](https://avatars.githubusercontent.com/u/1426889?v=4)](https://github.com/cat24max "cat24max (1 commits)")

---

Tags

apibattleyebattleye-commandsbattleye-serverclientcomposerphpphp-libraryrconsocketclientclasslightweightrcondayzbattleyearma3arma2

### Embed Badge

![Health badge](/badges/nizarii-arma-rcon-class/health.svg)

```
[![Health](https://phpackages.com/badges/nizarii-arma-rcon-class/health.svg)](https://phpackages.com/packages/nizarii-arma-rcon-class)
```

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69333.0M114](/packages/algolia-algoliasearch-client-php)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[gmostafa/php-graphql-client

GraphQL client and query builder.

3217.6M25](/packages/gmostafa-php-graphql-client)[razorpay/razorpay

Razorpay PHP Client Library

2024.8M44](/packages/razorpay-razorpay)

PHPackages © 2026

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