pschilly / dcs-server-bot-api
This package acts as an interface service for the DCS Server Bot RestAPI in order to access information from the bot on a remote web server for display purposes.
Fund package maintenance!
Pschilly
Requires
- php: ^8.3
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^2.0||^3.0
- pestphp/pest-plugin-arch: ^2.5||^3.0
- pestphp/pest-plugin-laravel: ^2.0||^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
README
This package acts as an interface service for the DCS Server Bot RestAPI in order to access information from the bot on a remote web server for display purposes.
In order for this to be function, you must already have the DCS Server Bot setup and running, including the following plugin / service:
Installation
You can install the package via composer:
composer require pschilly/dcs-server-bot-api
Configuration
In order for the service to know where to make the API calls you must identify where the API server is located. By default, the service will look for http://localhost:9876
- this is only going to be useful if you are running your website on the same server as the master node of the DCS Server bot.
To alter this default URL, run one of the following commands:
php artisan dcs-server-bot-api:install
php artisan dcs-server-bot-api:install --url="http://localhost:9867" [--force]
Although possible, it is not necessary to publish the config file given that the singular config parameter is pulled from your applications .env. Never the less, this is the command and contents of the published config file:
php artisan vendor:publish --tag="dcs-server-bot-api-config"
return [ /* |-------------------------------------------------------------------------- | DCS Bot API URL |-------------------------------------------------------------------------- | | This value is the base URL for the DCS Bot API, which will be used when | making requests to the API endpoints. | | See documentation of DCS Server Bot API for more details & configuration on your actual DCS Server Bot. | WebService: https://github.com/Special-K-s-Flightsim-Bots/DCSServerBot/blob/master/services/webservice/README.md | RestAPI: https://github.com/Special-K-s-Flightsim-Bots/DCSServerBot/blob/master/plugins/restapi/README.md | */ 'base_url' => env('DCS_BOT_API_URL', 'http://localhost:9876'), ];
Usage
Import the model:
use Pschilly\DcsServerBotApi\DcsServerBotApi;
Call the endpoint that you need based on the DCS Server Bot RestAPI Docs, eg:
$data = DcsServerBotApi::getServerStats();
This will give you a json array that you can then do with what you please!
For more information on the API - you can enable "debug" mode on your WebService plugin where you will then be able to hit the API server with the following link http://localhost:9678/docs
and get a full rundown on the API calls.
Changelog
Please see CHANGELOG for more information on what has changed recently.
TODO
- Add Caching Support
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.