From 617ed55c51e55fec027197f62d37198d9b323083 Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Sun, 28 Jan 2024 09:18:03 +0800 Subject: [PATCH] Update docs --- README.md | 34 +++++++++++++++++++++++++++++----- docs/get-started/index.rst | 1 + docs/get-started/install.rst | 8 ++++++++ docs/get-started/usage.rst | 31 +++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 docs/get-started/usage.rst diff --git a/README.md b/README.md index 19fb68d..8176822 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,49 @@ The OpenGSQ PHP library provides a convenient way to query servers from applications written in the PHP language. -## Requirements +## System Requirements -- php 8.1.2+ +- [PHP 8.1.2](https://www.php.net) or higher ## Installation -The recommended installation method is using composer +The recommended way to install the OpenGSQ PHP library is through Composer, a tool for dependency management in PHP. You can install it by running the following command in your terminal: ```sh -composer install opengsq +composer require opengsq/opengsq-php ``` ## Basic Usage -Here’s an example of how to query a server using the Vcmp protocol: +Here’s a quick example of how you can use the OpenGSQ library to query a server using the VCMP protocol: ```php getStatus(); + +// Output the status information +var_dump($status); + +// Get the players on the server +$players = $vcmp->getPlayers(); + +// Output the player information +var_dump($players); ``` + +In this example, we first include the Composer autoloader and import the `Vcmp` class. We then create a new `Vcmp` object, specifying the host and port of the server we want to query. Finally, we call the `getStatus` and `getPlayers` methods to retrieve and output information about the server and its players. + +## License + +This project is licensed under the MIT License. See the [LICENSE](https://github.com/opengsq/opengsq-php/blob/main/LICENSE) file for details. diff --git a/docs/get-started/index.rst b/docs/get-started/index.rst index 252af32..438cdd8 100644 --- a/docs/get-started/index.rst +++ b/docs/get-started/index.rst @@ -9,3 +9,4 @@ documentation. :maxdepth: 3 install + usage diff --git a/docs/get-started/install.rst b/docs/get-started/install.rst index b788984..4417998 100644 --- a/docs/get-started/install.rst +++ b/docs/get-started/install.rst @@ -7,3 +7,11 @@ System Requirements .. _Composer: https://getcomposer.org .. _`PHP 8.1.2`: https://www.php.net + +Installation +------------ +The recommended way to install the OpenGSQ PHP library is through Composer, a tool for dependency management in PHP. You can install it by running the following command in your terminal: + +.. code-block:: console + + composer require opengsq/opengsq-php diff --git a/docs/get-started/usage.rst b/docs/get-started/usage.rst new file mode 100644 index 0000000..dd4d2ee --- /dev/null +++ b/docs/get-started/usage.rst @@ -0,0 +1,31 @@ +Basic Usage +=========== + +Here's a quick example of how you can use the OpenGSQ library to query a server using the VCMP protocol: + +.. code-block:: php + + getStatus(); + + // Output the status information + var_dump($status); + + // Get the players on the server + $players = $vcmp->getPlayers(); + + // Output the player information + var_dump($players); + +In this example, we first include the Composer autoloader and import the `Vcmp` class. We then create a new `Vcmp` object, specifying the host and port of the server we want to query. Finally, we call the `getStatus` and `getPlayers` methods to retrieve and output information about the server and its players.