PHP code example of hyperplural / ohmywishes

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

    

hyperplural / ohmywishes example snippets




declare(strict_types=1);

use Hyperplural\Ohmywishes\Auth\StaticTokenProvider;
use Hyperplural\Ohmywishes\Client\ClientConfig;
use Hyperplural\Ohmywishes\Client\OhMyWishesClient;

$client = new OhMyWishesClient(
    new ClientConfig(),
    new StaticTokenProvider('your-access-token'),
);

$profile = $client->users()->self();

echo $profile->fullName;

$client->auth(function (string $purpose, array $context): string {
    return getCaptchaTokenSomehow($purpose, $context);
})->requestPhoneNumberConfirmationCode('+79990000000');

$response = $client->raw()->request('GET', '/api/v3/client');
$payload = $response->json();

use Hyperplural\Ohmywishes\Client\ClientConfig;
use Hyperplural\Ohmywishes\Client\OhMyWishesClient;

$client = new OhMyWishesClient(
    new ClientConfig(
        guzzleOptions: [
            'timeout' => 10,
            'proxy' => 'http://127.0.0.1:8080',
        ],
    ),
);