1. Go to this page and download the library: Download soiposervices/comfydeploy 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 / comfydeploy example snippets
use SoipoServices\ComfyDeploy\ComfyDeploy;
...
$api = new ComfyDeploy(
apiToken: $_ENV['COMFY_DEPLOY_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(ComfyDeploy::class, function () {
return new ComfyDeploy(
apiToken: config('services.comfy_deploy.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(ComfyDeploy::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(ComfyDeploy::class)->workflows()->get($run_id);