1. Go to this page and download the library: Download soiposervices/runpod 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/ */
soiposervices / runpod example snippets
use SoipoServices\runpod\runpod;
...
$api = new runpod(
apiToken: $_ENV['RUNPOD_API_TOKEN'],
);
$deployment_id = 'e4a14vs9-q40j-4ee2-1375-778b2je3221c';
$input = [
'model' => 'prompt',
'postive_prompt' => 'a photo of an astronaut riding a horse on mars',
'seed' => null,
];
$data = $api->workflows()->run($deployment_id, $input);
$data->run_id; // 257b65b8-ac23-49be-8aca-53d2dd8556c6
// app/Providers/AppServiceProvider.php
public function register()
{
$this->app->bind(runpod::class, function () {
return new runpod(
apiToken: config('services.runpod.api_token'),
);
});
}
use Saloon\Laravel\Saloon; // composer ixture('getWorkflow'),
]);
$run_id = '257b65b8-ac23-49be-8aca-53d2dd8556c6';
// The initial request will check if a fixture called "getWorkflow"
// exists. Because it doesn't exist yet, the real request will be
// sent and the response will be recorded to tests/Fixtures/Saloon/getWorkflow.json.
$data = app(runpod::class)->workflows()->get($run_id);
// However, the next time the request is made, the fixture will
// exist, and Saloon will not make the request again.
$data = app(runpod::class)->workflows()->get($run_id);