PHP code example of findbrok / php-watson-api-bridge

1. Go to this page and download the library: Download findbrok/php-watson-api-bridge 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/ */

    

findbrok / php-watson-api-bridge example snippets




use FindBrok\WatsonBridge\Bridge;

// Create a new bridge Object.
$bridge = new Bridge('username', 'password', 'baseUrl');

// Simple get request.
$queryParams = ['foo' => 'bar'];
$response = $bridge->get('uri', $queryParams);

// Simple post request.
$dataToPost = ['foo' => 'bar'];
$response = $bridge->post('uri', $dataToPost, 'json');

'providers' => [
   ....
   FindBrok\WatsonBridge\WatsonBridgeServiceProvider::class,
]

'aliases' => [
    ...
    'Bridge'      => FindBrok\WatsonBridge\Facades\Bridge::class,
    'BridgeStack' => FindBrok\WatsonBridge\Facades\BridgeStack::class,
    'Carpenter'   => FindBrok\WatsonBridge\Facades\Carpenter::class,
]

$response = $bridge->get('uri', $queryParams);

$carpenter = app()->make(Carpenter::class);

$bridge = $carpenter->constructBridge('default', 'personality_insights');

$stack = app()->make(BridgeStack::class);

$stack->mountBridge('myPIBridge', 'default', 'personality_insights');
$stack->mountBridge('myTABridge', 'default', 'tradeoff_analytics');

// Now use the Bridges stored in the Stack.
$response = $stack->conjure('myPIBridge')->post('/v3/profile', $dataToPost);
bash
$ composer 
app.php
app.php
watson-bridge.php
put
watson-bridge.php