PHP code example of verifymycontent / sdk

1. Go to this page and download the library: Download verifymycontent/sdk 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/ */

    

verifymycontent / sdk example snippets



 = new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$response = $vmc->identityVerification->createIdentityVerification(
    new \VerifyMyContent\SDK\IdentityVerification\Entity\Requests\CreateIdentityVerificationRequest([
        "customer" => [
            "id" => "YOUR-CUSTOMER-UNIQUE-ID",
            "email" => "[email protected]",
            "phone" => "+4412345678"
        ],
        "redirect_uri" => "https://example.com/callback",
        "webhook" => "https://example.com/webhook",
    ])
);

// save $response->id if you want to save the verification of your customer

// redirect user to check identity
header("Location: {$response->redirect_uri}");


 = new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$response = $vmc->identityVerification->getIdentityVerification("YOUR-IDENTITY-VERIFICATION-ID");

// Printing current status
echo "Status: {$response->status}";


a = json_decode(file_get_contents('php://input'), true);
$webhook = new \VerifyMyContent\SDK\IdentityVerification\Entity\Requests\WebhookIdentityVerificationRequest($data);

// Printing current status
echo "Status: {$webhook->status} received from verification {$webhook->id}";

// This is how you can check if the identity verification is approved.
if ($webhook->status === \VerifyMyContent\SDK\IdentityVerification\IdentityVerificationStatus::APPROVED) {
    // do your thing
}



= new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$response = $vmc->contentModeration()->createStaticContentModeration([
  "content" => [
    "type" => "video",
    "external_id" => "YOUR-VIDEO-ID",
    "url" => "https://example.com/video.mp4",
    "title" => "Uploaded video title",
    "description" => "Uploaded video description",
  ],
  "webhook" => "https://example.com/webhook",
  "redirect_url" => "https://example.com/callback",
  "customer" => [
    "id" => "YOUR-CUSTOMER-UNIQUE-ID",
    "email" => "[email protected]",
    "phone" => "+4412345678"
  ],
  "type" => "face-match",
  "rule" => "default",
  "faces_id" => ["ID"],
  "collection_id" => "YOUR-COLLECTION-ID",
  "participants" => [[
            "id" => "YOUR-CUSTOMER-UNIQUE-ID",
            "email" => "[email protected]",
            "phone" => "+4412345678"
  ]]
]);

// save $response->id if you want to call the moderation status endpoint later

// redirect uploader to check identity
header("Location: {$response->redirect_url}");



= new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$response = $vmc->contentModeration()->getStaticContentModeration("YOUR-CONTENT-MODERATION-ID");

// Printing current status
echo "Status: {$response->status}";


a = json_decode(file_get_contents('php://input'), true);
$webhook = new \VerifyMyContent\SDK\ContentModeration\Entity\Requests\WebhookStaticContentModerationRequest($data);

// Printing current status
echo "Status: {$webhook->status} received from static content {$webhook->id}";

// This is how you can check if the moderation was approved.
if ($webhook->status === \VerifyMyContent\SDK\ContentModeration\ContentModerationStatus::STATIC_APPROVED) {
    // do your thing
}



= new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$response = $vmc->contentModeration()->createLiveContentModeration([
  "external_id" => "YOUR-LIVESTREAM-ID",
  "embed_url" => "https://example.com/live/",
  "title" => "Live stream title",
  "description" => "Live stream description",
  "webhook" => "https://example.com/webhook",
  "stream" => [
      "protocol" => "webrtc",
      "url" => "https://example.com/live/",
  ],
  "customer" => [
      "id" => "YOUR-CUSTOMER-UNIQUE-ID",
      "email" => "[email protected]",
      "phone" => "+4412345678"
  ],
  "type" => "face-match",
  "rule" => "default",
  "faces_id" => ["ID"],
  "collection_id" => "YOUR-COLLECTION-ID"
]);

// save $response->id to start live stream later

// redirect uploader to check identity
header("Location: {$response->login_url}");



vmc = new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$vmc->contentModeration()->startLiveContentModeration("YOUR-CONTENT-MODERATION-ID");

// that's all folks!


a = json_decode(file_get_contents('php://input'), true);
$webhook = new \VerifyMyContent\SDK\ContentModeration\Entity\Requests\WebhookLiveContentModerationRequest($data);

// Printing current status
echo "Status: {$webhook->status} received from live content {$webhook->id}";

// This is how you can check if the live stream is authorized.
if ($webhook->status === \VerifyMyContent\SDK\ContentModeration\ContentModerationStatus::LIVE_AUTHORIZED
    // do your thing
}



vmc = new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$vmc->contentModeration()->changeLiveContentRule("YOUR-CONTENT-MODERATION-ID");



vmc = new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$vmc->contentModeration()->pauseLivestream("YOUR-CONTENT-MODERATION-ID");



vmc = new VerifyMyContent\VerifyMyContent(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();

$vmc->contentModeration()->resumeLivestream("YOUR-CONTENT-MODERATION-ID");