Code Monkey home page Code Monkey logo

laravel-rcon's Introduction

Source RCON Protocol Service Provider for Laravel

This package is developed to provide Laravel Framework service allowing you to work with source RCON protocol. You can read more protocol specification on this page: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol

Installation

  1. Install composer package using command:
composer require lukasz-adamski/laravel-rcon
  1. Add Service Provider in config/app.php:
Adams\Rcon\RconServiceProvider::class,
  1. Add Facade in config/app.php:
'Rcon' => Adams\Rcon\Facades\Facade::class,
  1. Publish configuration file to your project:
php artisan vendor:publish --provider="Adams\Rcon\RconServiceProvider"

Environment

You can setup environment variables to establish default RCON connection.

  • RCON_CONNECTION - default RCON connection name stored in config/rcon.php,
  • RCON_HOST - RCON server hostname,
  • RCON_PORT - RCON server listening port,
  • RCON_PASSWORD - passphrase used to authorize connection, you can use null to skip authorization,
  • RCON_TIMEOUT - RCON server connection timeout.

Testing

To run predefined test set use:

php vendor/bin/phpunit

Usage

Below you have example controller implementation:

<?php

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'));
    }
}

laravel-rcon's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.