intvent/transip-laravel

A Laravel wrapper for the TransIP REST API Client.
13,028
Install
composer require intvent/transip-laravel
Latest Version:v1.3
PHP:^7.2.0|^8.0
License:MIT
Last Updated:Apr 22, 2024
Links: GitHub  ·  Packagist
Maintainer: petericebear

Laravel TransIP Rest Client - Wrapper

A very easy way to use the TransIP Rest API in your Laravel Project.

Latest Version on Packagist Software License Total Downloads

Link to documentation

To make full advantage of this package you can see here what functionality can be used within the API of TransIP.

TransIP RestAPI Docs
TransIP PHP Package

Installation

First add your API credentials into your .env file.

TRANSIP_LOGIN=<your_login_name>
TRANSIP_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----<your_private_key_here-----END PRIVATE KEY-----"

# Use the token only with whitelisted IP's (true or false) defaults to true.  
TRANSIP_WHITELIST_ONLY=false

Install with composer

composer require intvent/transip-laravel

This package will autoload the SrviceProvider and Facade listed below. If it does not automatically you can add it easily with the following steps.

Register the Service Provider:

'providers' => [
    ...
    IntVent\TransIPLaravel\TransIPServiceProvider::class,
];

Optionally the Facade can be registered:

'aliases' => [
	...
    'TransIP' => IntVent\TransIPLaravel\TransIPFacade::class,
    ...
]

You must publish the configuration with this command:

php artisan vendor:publish --provider="IntVent\TransIPLaravel\TransIPServiceProvider"

This will add a configuration file called 'transip.php' in the config folder with the following contents:

return [

    /*
    |--------------------------------------------------------------------------
    | TransIP Laravel Wrapper
    |--------------------------------------------------------------------------
    |
    */

    'login' => env('TRANSIP_LOGIN'),

    'privateKey' => env('TRANSIP_PRIVATE_KEY'),

    'generateWhitelistOnlyTokens' => env('TRANSIP_WHITELIST_ONLY', true),

];

Usage

Using the Facade

<?php

use TransIP;

// Get all VPS from your account.
$allVps = TransIP::vps()->getAll();

Using the auto IoC binding

<?php

use Transip\Api\Library\TransipAPI;

class TransipTestCommand extends Command
{
    protected $signature = 'transip:test';
    
    public function __construct()
    {
        parent::__construct();
    }
    
    public function handle(TransipAPI $api))
    {
        $allVps = $api->vps()->getAll();
    }
}

Security

If you discover any security-related issues, please email info@intvent.nl instead of using the issue tracker.

Support

You can sponsor me, Peter Steenbergen also known as Peter Icebear, on Github sponsors or through this affiliate link.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444