Download the PHP package vizuaalog/pterodactyl-api without Composer
On this page you can find all versions of the php package vizuaalog/pterodactyl-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vizuaalog/pterodactyl-api
More information about vizuaalog/pterodactyl-api
Files in vizuaalog/pterodactyl-api
Package pterodactyl-api
Short Description An unofficial PHP API client for the Pterodactyl game panel.
License MIT
Informations about the package pterodactyl-api
Pterodactyl PHP
Pterodactyl PHP is an unofficial PHP API client for the Pterodactyl game panel. It offers an object orientated approach with a 'smarter' way of performing updates. This package was primarily written for the needs of a project, but I have tried to keep it as generic as I can to offer flexibility for others to use it as well.
This has been tested with Pterodactyl 0.7.16
The code has been documented so any good IDE should be able to help with autocompletion.
Installation
Installation is very easy thanks to composer. Simply run composer install vizuaalog/pterodactyl-php
.
Usage
This assumes you have setup composer within your project to allow for the use
statements.
Everything starts with the primary Pterodactyl
class:
$api_key
(string) - This should be the API key generated either via the admin section of the panel or the user section$base_uri
(string) - This is the base uri of your panel. E.g. 'https://pterodactyl.app'$type
(string, defaultapplication
) - This is the type of API routes you would like to use. If you provide an API key from the user section, then set this toclient
otherwise the defaultapplication
is fine.
All of the values provided to a create or update method follow the exact requirements of the Pterodactyl API and it's advised to look at the documentation for this.
Update methods called directly on a resource will help where possible and prefill any required fields that you do not pass. E.g. only wanting to update the name of the server - Pterodactyl requires more than just the name be provided in the request, so this is done behind the scenes.
Some methods have two different variants, the first is if you already have the resource object, helps with readability. The second is if you only have an id and do not want to get the resource details first.
Servers
Below are the methods available for managing servers.
User
Below are the methods available for managing users.
Nodes
Below are the methods available for managing nodes.
Locations
Below are the methods available for managing locations.
Nests/Eggs
Below are the methods available for managing nests and eggs.
Exceptions
- Providing no API key to the Pterodactyl constructor will throw an InvalidApiKeyException.
- Providing no base uri to the Pterodactyl constructor will throw an InvalidBaseUriException.
- If Pterodactyl returns an exception error a PterodactylRequestException is thrown for most methods, this exception will contain some of the information sent from the panel to help diagnose the issue.
- In some cases a GuzzelException, ClientException or ServerException may be thrown which will indicate an issue communicating with the panel. In most cases these are translated to a PterodactylRequestException so shouldn't happen too often.