Simple PHP API client for tube-hosting.com rest API

Related tags

API TubePHP-API
Overview

Tube-Hosting API PHP client

Explanation

This PHP library is a simple api wrapper/client for the tube-hosting.com api.
It is based on the provided documentation.
The wrapper is built oriented to the so-called "schemas", where the documentation specified endpoints are assigned to, in a specific order.
In the documentation, we see that the endpoints are ordered in thirteen tags, which are each put into an object.
Here is how they are ordered:


Object: Service ServiceGroupData IPv4 IPv4Bundle DedicatedInstanceRequest VPS User Payment Template Dedicated
Tags: service-controller service-group-controller ip-controller ip-bundle-controller admin-dedicated-repository vps-controller authentication-controller payment-controller template-controlle dedicated-controller
Tags: me-controller order-controller

Installation

The Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
After installing Composer in your project, just add this line to your composer.json file.

"tubehosting/tubephp-api": "^0.1-beta"

or run

$ composer require tubehosting/tubephp-api:0.1-beta

in your shell.

This library also requires PHP version 8.0 or higher and the PHP curl extension.

Usage

Here we got a pretty simple example where we log in into a Tube-Hosting Account, fetch information about a VPS and display this information:

A simple example:

<?php
use TubeAPI\Objects; //import into global namespace

require 'vendor/autoload.php'; //Load the Composer autoloader

$password = "Password123"; 
$mail = "[email protected]"; 

try {
    $user = Objects\User::login(new Objects\AuthenticationLoginData($mail, $password)); //login using the credentials of an existing tube-hosting.de account (the login returns a new user object)
    $vps = Objects\VPS::getServerById(488); //get a VPS by the id, returns new VPS object
    $vpsStatus = Objects\VPS::getServerStatusById(488); //get status information of VPS, returns new VpsStatus Object

    //print different information about the VPS
    print "Overview ".$vps->getVpsType()." - ".$vps->getName() . "\n"; 
    print "Node: " . $vps->getNodeId() . "\n"; 
    print "IP: " . $vps->getPrimaryIPv4()->getIpv4()->getIpv4() ."\n"; 
    print "OS: " . $vps->getOsDisplayName() . "\n"; 
    print " - " . $vps->getCoreCount() . " CPU Cores, Usage: ".(int)($vpsStatus->getCpu()*100) . "%\n"; 
    print " - " . number_format($vpsStatus->getMem() / 1048576) . "/".  number_format($vps->getMemory()) ." GB RAM\n"; 
    print " - " . $vps->getDiskType() ." -> " . number_format($vps->getDiskSpace()/1024) ." GB\n"; 
    print "Price: €" . $vps->getPrice()/100 . " (".$vps->getPriceType().")\n"; 
    print "Bought on: " . $vps->getStartDate() . "\n";
    print "Paid until: " . $vps->getRuntime() . "\n";

}catch (\Exception $e) {
    print $e->getMessage() . "\n"; //a request can throw some exceptions, take a look at the examples 
}

The (example) output:

Overview KVM - server488
Node: 6
IP: 193.111.248.90
OS: Debian 11 (Bullseye) 64-bit, German
 - 2 CPU Cores, Usage: 32%
 - 1,165/2,048 GB RAM
 - SSD -> 24 GB
Price: €5 (GROSS)
Bought on: 2021-11-30T10:09:22Z
Paid until: 2021-12-28T00:00:00Z

Take a look on more examples in the examples directory

LICENSE:

This software is distributed under the MIT license.

You might also like...
A REST API that should power the Agile Monkeys CRM Service

This is a simple REST API that purposes to power the Agile Monkeys CRM service

A lightweight REST API framework

php-microframework A minimal PHP 8 REST API built onto php-microframework. Features Automatic routing based on URL path, e.g. https://domain/controlle

Osclass REST API plugin.

Osclass API Osclass API plugin, with all the required endpoints and JWT auth. Osclass App (Native + PWA) You always wanted a mobile app for Osclass, d

Joy VoyagerApi module adds REST Api end points to Voyager with Passport and Swagger support.
Joy VoyagerApi module adds REST Api end points to Voyager with Passport and Swagger support.

Joy VoyagerApi This Laravel/Voyager module adds REST Api with Passport and Swagger support to Voyager. By 🐼 Ramakant Gangwar. Prerequisites Composer

A rest api repository with laravel.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

A rest api repository with laravel.

API Back End This is the repository for the TKJ 1 Class 12 Web Back End API system, for detailed info, you can go to the main link of the Front End ap

A chess REST API.
A chess REST API.

Chess API A chess REST API. Documentation Read the latest docs here. Installation Clone the chesslablab/chess-api repo into your projects folder as it

API-Rest para información sobre administración-politica de Cuba

API_CUBA API desarrollada con Laravel PHP para brindar servicios REST para multiples plataformas sobre información politico administrativa de API_CUBA

Extended response classes for Rest API clients/SDKs
Extended response classes for Rest API clients/SDKs

Rest Response Extended response classes for Rest API clients/SDKs. About This package is intended to be component of SDKs so the responses can be easi

Releases(v1.2)
  • v1.2(Oct 25, 2022)

    Since the last update, there have been some (really) small changes

    Improvements/suggestions are welcome


    This release of the Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
    After installing Composer in your project, just add this line to your composer.json file.

    "tubehosting/tubephp-api": "^1.2"
    

    or run

    $ composer require tubehosting/tubephp-api
    

    in your shell.

    This version also requires PHP version 7.1 or higher and the PHP curl and json extensions.


    Source code(tar.gz)
    Source code(zip)
  • v1.1(Mar 2, 2022)

    Lately there have been a few new updates to the API, including new metrics for DDos attacks, etc..

    Improvements/suggestions are welcome


    This release of the Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
    After installing Composer in your project, just add this line to your composer.json file.

    "tubehosting/tubephp-api": "^1.1"
    

    or run

    $ composer require tubehosting/tubephp-api
    

    in your shell.

    This version also requires PHP version 7.1 or higher and the PHP curl and json extensions.


    Source code(tar.gz)
    Source code(zip)
  • v1.0(Jan 17, 2022)

    Hey, I just pushed some changes, and I think this client is ready to get the first stable version released :D

    Improvements/suggestions are welcome


    • automatic tests of requests, etc.
    • way better response handling, object parsing, etc-
    • partly rebuild how the request ist send

    This release of the Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
    After installing Composer in your project, just add this line to your composer.json file.

    "tubehosting/tubephp-api": "^1.0"
    

    or run

    $ composer require tubehosting/tubephp-api
    

    in your shell.

    This version also requires PHP version 7.1 or higher and the PHP curl and json extensions.


    Source code(tar.gz)
    Source code(zip)
  • v0.4-beta(Jan 3, 2022)

    The fourth release, not yet 100% tested, matured and therefore marked as unstable. Improvements/suggestions are welcome


    • switched to PHP 7.1 (and greater) from PHP 8.x because PHP 7.1 is more widely adapted

    This release of the Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
    After installing Composer in your project, just add this line to your composer.json file.

    "tubehosting/tubephp-api": "^0.4-beta"
    

    or run

    $ composer require tubehosting/tubephp-api:0.4-beta
    

    in your shell.

    This version also requires PHP version 7.1 or higher and the PHP curl and json extensions.


    Source code(tar.gz)
    Source code(zip)
  • v0.3-beta(Jan 1, 2022)

    The third release, not yet fully tested, matured and therefore marked as unstable. Improvements/suggestions are welcome


    • handle unexpected responses partly better
    • gave more information on exception (on request)

    This release of the Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
    After installing Composer in your project, just add this line to your composer.json file.

    "tubehosting/tubephp-api": "^0.3-beta"
    

    or run

    $ composer require tubehosting/tubephp-api:0.3-beta
    

    in your shell.

    This version also requires PHP version 8.0 or higher and the PHP curl extension.


    Source code(tar.gz)
    Source code(zip)
  • v0.2-beta(Dec 31, 2021)

    The second release, not yet fully tested, matured and therefore marked as unstable. Improvements/suggestions are welcome


    • handle empty responses without throwing unnecessary warnings and make the null value clear
    • reordered examples and changed wording

    This release of the Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
    After installing Composer in your project, just add this line to your composer.json file.

    "tubehosting/tubephp-api": "^0.2-beta"
    

    or run

    $ composer require tubehosting/tubephp-api:0.2-beta
    

    in your shell.

    This version also requires PHP version 8.0 or higher and the PHP curl extension.


    I planned to get back to PHP 7.x, because PHP 8.x is partly poorly represented in production etc., this is probably going to be the first stable release :)

    Source code(tar.gz)
    Source code(zip)
  • v0.1-beta(Dec 17, 2021)

    The first release, not yet fully tested, matured and therefore marked as unstable. Improvements/suggestions are welcome


    This release of the Tube-Hosting PHP API is available over Packagist, and an installation in your project is recommended via Composer.
    After installing Composer in your project, just add this line to your composer.json file.

    "tubehosting/tubephp-api": "^0.1-beta"
    

    or run

    $ composer require tubehosting/tubephp-api:0.1-beta
    

    in your shell.

    This version also requires PHP version 8.0 or higher and the PHP curl extension.

    Source code(tar.gz)
    Source code(zip)
Owner
null
Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and / or RESTful API

Luracast Restler ![Gitter](https://badges.gitter.im/Join Chat.svg) Version 3.0 Release Candidate 5 Restler is a simple and effective multi-format Web

Luracast 1.4k Dec 14, 2022
A simple, extensible REST API framework for PHP

Note: This framework is not stable yet. Introduction Aphiria is a suite of small, decoupled PHP libraries that make up a REST API framework. It simpli

Aphiria 119 Dec 23, 2022
Quickly and easily expose Doctrine entities as REST resource endpoints with the use of simple configuration with annotations, yaml, json or a PHP array.

Drest Dress up doctrine entities and expose them as REST resources This library allows you to quickly annotate your doctrine entities into restful res

Lee Davis 88 Nov 5, 2022
GraphQL API to Studio Ghibli REST API

GhibliQL GhibliQL is a GraphQL wrapper to the Studio Ghibli REST API Usage First, you'll need a GraphQL client to query GhibliQL, like GraphQL IDE Con

Sebastien Bizet 8 Nov 5, 2022
Single file PHP script that adds a REST API to a SQL database

PHP-CRUD-API Single file PHP script that adds a REST API to a MySQL/MariaDB, PostgreSQL, SQL Server or SQLite database. NB: This is the TreeQL referen

Maurits van der Schee 3.2k Jan 8, 2023
PHP REST API Framework

PSX Framework About PSX is a framework written in PHP dedicated to build REST APIs. It is based on multiple components which cover many aspects of the

Apioo 121 Dec 30, 2022
PHP REST API without using any frameworks. Contains all CRUD operations.

PHP REST API without any framework and CRUD operations ?? Hi there, this is a simple REST API built in PHP without using any frameworks. This is built

Hanoak 10 Sep 5, 2022
Phalcon PHP REST API Package, still in beta, please submit issues or pull requests

PhREST API A Phalcon REST API package, based on Apigees guidelines as found in http://apigee.com/about/content/web-api-design Please see the skeleton

PhREST 29 Dec 27, 2022
Simple Client for Airtable API

Airtable Client Bundle (Work In Progress) The Airtable Client bundle is a Symfony bundle that attempts to make the Airtable API easier to use. Retriev

Yoan Bernabeu 28 May 12, 2022
example repository training REST API

adalah codebase REST-API dari tugas peserta yang mengikuti training membangun REST API dengan lumen selama 2 minggu. studi kasus nya adalah REST API website marketplace untuk agrobisniss.

Nuris Akbar 6 Sep 4, 2021