PHP code example of upmind / provision-provider-hello-world

1. Go to this page and download the library: Download upmind/provision-provider-hello-world 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/ */

    

upmind / provision-provider-hello-world example snippets




use Illuminate\Support\Facades\App;
use Upmind\ProvisionBase\ProviderFactory;

$configuration = [
    'api_key' => 'example',
    'api_secret' => 'shhh!',
];

$factory = App::make(ProviderFactory::class);
$provider = $factory->create('hello-world', 'hello-foo', $configuration);

$createParameters = [
    'name' => 'Harry',
];
$function = $provider->makeJob('greeting', $createParameters);

$greetingResult = $function->execute();

if ($greetingResult->isError()) {
    throw new RuntimeException($greetingResult->getMessage(), 0, $greetingResult->getException());
}

/** @var \Upmind\ProvisionProviders\HelloWorld\Data\Greeting */
$greeting = $greetingResult->getData();

// $greeting->sentence; // Hello Harry! From your friend, Foo.
// ...