PHP code example of snapwonders / sdk

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

    

snapwonders / sdk example snippets




napWonders\Client;

$client = new Client('sw_your_key_here');   // base URL defaults to https://snapwonders.com
print_r($client->status());                  // no key needed for status

// Hide a secret inside a cover image (the last file is the cover).
$job = $client->stego->hide(['secret.png', 'cover.jpg'], password: 'Str0ng!Pass');
foreach ($job->results() as $result) {
    $result->download('out/');               // "out/" is a directory — the server filename is kept
}

// Reveal it again.
$job = $client->stego->reveal('out/cover-share.avif', password: 'Str0ng!Pass');
$job->results()[0]->download('recovered/');

// Forensic analysis — grade each file A–F, collect the overlay assets it produced.
$job = $client->analyse->run(['photo.jpg'], options: ['face_detection' => true]);
foreach ($job->results() as $item) {
    echo "{$item->filename}  {$item->grade}  faces={$item->faceCount}\n";
    foreach ($item->assets as $asset) {      // ELA map, face overlay, …
        $asset->download('out/');
    }
}

// Convert media — the image format key is `image_format` (jpeg/png/webp/avif/heic/jxl).
$job = $client->convert->run(['photo.png'], options: ['image_format' => 'webp']);
$job->results()[0]->download('out/');
bash
composer install
export SNAPWONDERS_API_KEY=sw_your_key_here
php examples/hide_and_reveal.php     # hide a file in an image, then reveal it
php examples/analyse.php             # grade an image A–F + download overlay assets
php examples/convert.php             # PNG → WebP