PHP code example of webaround / openai-ads-laravel
1. Go to this page and download the library: Download webaround/openai-ads-laravel 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/ */
webaround / openai-ads-laravel example snippets
use WebaroundLabs\OpenAIAds\Laravel\Facades\OpenAIAds;
use WebaroundLabs\OpenAIAds\{ActionSource, Event, EventId, EventName, SystemClock, UserData};
$context = OpenAIAds::context();
$event = Event::create(
name: EventName::LeadCreated,
id: EventId::fromBusinessId($lead->id),
timestampMs: app(\WebaroundLabs\OpenAIAds\Clock::class)->nowMs(),
actionSource: ActionSource::Web,
sourceUrl: $context->sourceUrl(),
user: UserData::create(
email: $lead->email,
obref: $context->obref(),
ipAddress: $context->ipAddress(),
userAgent: $context->userAgent(),
),
oppref: $context->oppref(),
);
OpenAIAds::queue($event); // off the request cycle - the usual choice
OpenAIAds::send($event); // inline; blocks until OpenAI answers
OpenAIAds::validate($event); // the API's documented validation mode