1. Go to this page and download the library: Download vizuaalog/pterodactyl-api 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/ */
vizuaalog / pterodactyl-api example snippets
use VizuaaLOG\Pterodactyl\Pterodactyl;
$panel = new Pterodactyl(string $api_key, string $base_uri, string $type = 'application');
// Returns an array of Server objects.
$servers = $panel->servers->all();
// Returns a single Server object
// If using the client mode, then this should be the string identifier instead
// $s);
// Returns a single Server object if successful, throws exception on error
$server = $panel->servers->create(array $data);
// Update a server's details
// Returns the updated Server object
$server->update(array $data);
$panel->servers->update(int $server_id, array $data);
// Update a server's build configuration
// Returns the updated Server object
$server->updateBuild(array $data);
$panel->servers->updateBuild(int $server_id, array $data);
// Update a server's startup configuration
// Returns the updated server object
$server->updateStartup(array $data);
$panel->servers->updateStartup(int $server_id, array $data);
// Suspend a server
// Returns true if successful, false otherwise
$server->suspend();
$panel->servers->suspend(int $server_id);
// Unsuspend a server
// Returns true if successful, false otherwise
$server->unsuspend();
$panel->servers->unsuspend(int $server_id);
// Reinstall a server
// Returns true if successful, false otherwise
$server->reinstall();
$panel->servers->reinstall(int $server_id);
// Rebuild a server
// Returns true is successful, false otherwise
$server->rebuild();
$panel->servers->rebuild(int $server_id);
// Delete a server
// Returns true if successful, false otherwise
$server->delete(bool $force = false);
$panel->servers->delete(int $server_id, bool $force = false);
// Get all databases for a server
// Returns an array of ServerDatabase objects
$server->databases();
$panel->servers->databases(int $server_id);
// Get a database for a server
// Returns a single ServerDatabase object
$server->database(int $database_id);
$panel->servers->database(int $server_id, int $database_id);
// Create a database for a server
// Returns a single ServerDatabase object
$server->createDatabase(array $data);
$panel->servers->createDatabase(int $server_id, array $data);
// Reset a database's password
// Returns true on success, false otherwise
$server->resetDatabasePassword(int $database_id);
$panel->servers->resetDatabasePassword(int $server_id, int $database_id);
// Delete a database
// Returns true on success, false otherwise
$server->deleteDatabase(int $database_id);
$panel->servers->deleteDatabase(int $database_id);
// Get all users
// Returns an array of User objects
$users = $panel->users->all();
// Get a single user
// Returns a single User object
// $es is an array of strings representing additional data to turns the updated User object
$user->update(array $data);
$panel->users->update(int $user_id, array $data);
// Delete a user
// Returns true on success, false otherwise
$user->delete();
$panel->users->delete(int $user_id);
// Get all nodes
// Returns an array of Node objects
$nodes = $panel->nodes->all();
// Get a single node
// Returns a single Node object
// $ate(array $data);
// Edit a node
// Returns the updated Node object
$node->update(array $data);
$panel->nodes->update(int $node_id, array $data);
// Delete a node
// Returns true on success, false otherwise
$node->delete();
$panel->nodes->delete(int $node_id);
// Get a node's allocations
// Returns an array of Allocation objects
$allocations = $node->allocations();
$allocations = $panel->nodes->allocations(int $node_id);
// Create a new allocation
// Returns the newly created Allocation object
$allocation = $node->createAllocation(array $data);
$allocation = $panel->nodes->createAllocation(int $node_id, array $data);
// Delete an allocation
// Returns true on success, false otherwise
$node->deleteAllocation(int $allocation_id);
$panel->nodes->deleteAllocation(int $node_id, int $allocation_id);
// Get all locations
// Returns an array of Node objects
$locations = $panel->locations->all();
// Get a single location
// Returns a single Location object
// $ons->create(array $data);
// Edit a location
// Returns the updated Location object
$location->update(array $data);
$panel->locations->update(int $location_id, array $data);
// Delete a location
// Returns true on success, false otherwise
$location->delete();
$panel->locations->delete(int $location_id);
// Get all nests
// Returns an array of Nest objects
$nests = $panel->nests->all();
// Get a single nest
// Returns a single Nest object
// $ggs();
$nests = $panel->nests->eggs(int $nest_id);
// Get a single egg from a nest
// Returns a single Egg object
// $
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.