PHP code example of juststeveking / laravel-envoyer-sdk

1. Go to this page and download the library: Download juststeveking/laravel-envoyer-sdk 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/ */

    

juststeveking / laravel-envoyer-sdk example snippets


use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->projects->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->projects->save([
    'name' => 'SDK test',
    'provider' => 'github', // bitbucket, github, gitlab, gitlab-self
    'type' => 'laravel-5', // laravel-5. laravel-4, other
    'repository' => 'laravel/laravel',
    'branch' => 'master'
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->projects->find('id-of-project');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->projects->modify('id-of-project', [
    'name' => 'Project name update through SDK',
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->projects->delete('id-of-project');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->projects->updateSource('id-of-project', [
    'provider' => 'github',
    'repository' => 'laravel/laravel',
    'branch' => '8.x',
    'push_to_deploy' => true,
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->servers->on('id-of-project')->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->servers->on('id-of-project')->create([
    'name' => 'Server Name',
    'connectAs' => 'forge',
    'host' => 'ip-address-here',
    'phpVersion' => 'php80' // php80, php74, php73, php72, php71, php70, php56
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->servers->on('id-of-project')->first('id-of-your-server');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->servers->on('id-of-project')->modify('id-of-your-server', [
    'name' => 'SDK Server'
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->servers->on('id-of-project')->remove('id-of-your-server');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->environments->on('id-of-project')->key('1234')->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->environments->on('id-of-project')->key('1234')->servers();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->environments->on('id-of-project')
    ->key('1234')->onServer(1, 2, 3)
    ->put('test=api', 'another=value')

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->environments->on('id-of-project')->key('new-env-key')->reset('new-key');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->actions->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->hooks->on('id-of-project')->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->hooks->on('id-of-project')->create([
    'name' => 'list',
    'script' => 'll',
    'runAs' => 'forge',
    'actionId' => 'id-of-action',
    'timing' => 'after',
    'servers' => ['id-of-server', 'another-id-of-a-server']
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->hooks->on('id-of-project')->first('id-of-hook');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->hooks->on('id-of-project')->modify('id-of-hook', [
    'name' => 'list files and directories'
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->hooks->on('id-of-project')->remove('id-of-hook');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->deployments->on('id-of-project')->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

// Default Deployment
$envoyer->deployments->on('id-of-project')->deploy();

// Deployment from branch
$envoyer->deployments->on('id-of-project')->deploy([
    'from' => 'branch',
    'branch' => 'develop'
]);

// Deployment from tag
$envoyer->deployments->on('id-of-project')->deploy([
    'from' => 'tag',
    'tag' => 'v2.0.0'
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->deployments->on('id-of-project')->first('id-of-deployment');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->deployments->on('id-of-project')->cancel('id-of-deployment');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->collaborators->on('id-of-project')->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->collaborators->on('id-of-project')->invite([
    'email' => '[email protected]'
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->collaborators->on('id-of-project')->first('id-of-collaborator');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->collaborators->on('id-of-project')->remove('id-of-collaborator');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->notifications->on('id-of-project')->all();

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

// Create an Email Notification
$envoyer->notifications->on('id-of-project')->create([
    'name' => 'Notification Name',
    'type' => 'email', // email, discord, slack, teams
    'email_address' => '[email protected]'
]);

// Create a Discord Notification
$envoyer->notifications->on('id-of-project')->create([
    'name' => 'Notification Name',
    'type' => 'discord', // email, discord, slack, teams
    'discord_webhook' => 'url-of-webhook'
]);

// Create a Slack Notification
$envoyer->notifications->on('id-of-project')->create([
    'name' => 'Notification Name',
    'type' => 'slack', // email, discord, slack, teams
    'slack_webhook' => 'url-of-webhook'
]);

// Create a Teams Notification
$envoyer->notifications->on('id-of-project')->create([
    'name' => 'Notification Name',
    'type' => 'teams', // email, discord, slack, teams
    'teams_webhook' => 'url-of-webhook'
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->notifications->on('id-of-project')->first('id-of-notification');

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->notifications->on('id-of-project')->modify('id-of-notification', [
    'name' => 'Send Someone an email',
    'type' => 'email',
    'email_address' => '[email protected]'
]);

use JustSteveKing\Laravel\Envoyer\SDK\Envoyer;

$envoyer = Envoyer::illuminate(
    API_TOKEN_HERE,
    'https://envoyer.io/' // this is optional as is the default
);

$envoyer->notifications->on('id-of-project')->remove('id-of-notification');