PHP code example of xety / laravel-rcon

1. Go to this page and download the library: Download xety/laravel-rcon library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xety / laravel-rcon example snippets


Adams\Rcon\RconServiceProvider::class,

'Rcon' => Adams\Rcon\Facades\Facade::class,

php artisan vendor:publish --provider="Adams\Rcon\RconServiceProvider"



namespace App\Http\Controllers;

use Rcon;
use App\Http\Controllers\Controller;

class SimpleRconController extends Controller
{
    /**
     * Execute status command on default RCON server.
     *
     * @return Response
     */
    public function defaultStatus()
    {
        $response = Rcon::command('status');

        return view('console', compact('response'));
    }

    /**
     * Execute status command on specified RCON connection.
     *
     * @return Response
     */
    public function gameServerStatus()
    {
        $response = Rcon::connection('game_server')
            ->command('status');

        return view('console', compact('response'));
    }
}
bash
php vendor/bin/phpunit