Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8e5ca47
Merge pull request #349 from getyoti/development
mehmet-yoti Feb 19, 2024
1e23877
Merge pull request #351 from getyoti/development
mehmet-yoti Feb 21, 2024
c9a2b35
Merge pull request #347 from getyoti/release/4.2.2
mehmet-yoti Feb 21, 2024
726139a
Update README.md (#345)
nikhilPank Jul 25, 2024
3f90ff4
Added example for dbs and updated failure details (#362)
mehmet-yoti Jul 30, 2024
f752956
Release/4.3.0 (#364)
mehmet-yoti Jul 31, 2024
df0a9ee
Release 4.3.0 - Update (#366)
mehmet-yoti Aug 1, 2024
515ade7
Sdk 2481 (#369)
mehmet-yoti Sep 10, 2024
4af4eca
Master merge (#370)
mehmet-yoti Sep 10, 2024
7c52d7a
Merge Master Into Development (#368)
mehmet-yoti Sep 10, 2024
9f9b977
Release/4.3.1 (#372)
mehmet-yoti Sep 12, 2024
ce3fd6d
SDK-2472-added-php-idv-support-brand-id-in-session-config (#373)
mehmet-yoti Mar 14, 2025
530285f
Php sdk 2361 add optional attribute flag to sdk (#374)
mehmet-yoti Mar 14, 2025
4bf3fad
Sdk 2535 php sdk issue when retrieving session when a watchlist advan…
mehmet-yoti Mar 14, 2025
22c4a07
Sdk 2487 php support dark mode in idv sdk (#375)
mehmet-yoti Mar 14, 2025
046b040
Release/4.4.0 (#377)
mehmet-yoti Mar 19, 2025
17e9d91
SDK-2265 Retrieve Receipt (#323)
LuborRod Jun 21, 2024
805f520
SDK-2377 added failure reasons to idv (#356)
mehmet-yoti Jun 24, 2024
9a2f1c3
Sdk 2420 php add support for advanced identity profiles to share v 2 …
mehmet-yoti Jul 4, 2024
772a047
Added example for dbs and updated failure details (#362)
mehmet-yoti Jul 30, 2024
b90871f
Merge Master Into Development (#368)
mehmet-yoti Sep 10, 2024
3816902
SDK-2472-added-php-idv-support-brand-id-in-session-config (#373)
mehmet-yoti Mar 14, 2025
c8bda85
Php sdk 2361 add optional attribute flag to sdk (#374)
mehmet-yoti Mar 14, 2025
675a1a1
php 8.4 changes
mehmet-yoti Jun 5, 2025
4057c7e
php 8.4 changes
mehmet-yoti Jun 5, 2025
391cc5f
Merge pull request #380 from getyoti/master
mehmet-yoti Jun 10, 2025
6c7347e
updated env.template file
mehmet-yoti Jun 10, 2025
2abcbde
Merge pull request #381 from getyoti/php-8.4-dev
mehmet-yoti Jun 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,36 @@ jobs:

- run: composer test

php8-4:
name: Unit Tests php8.4 (php ${{ matrix.php-version }})
runs-on: ubuntu-latest
# always run on push events
# only run on pull_request_target event when pull request pulls from fork repository
if: >
github.event_name == 'push' ||
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
php-version: [ 8.4 ]

steps:
- uses: actions/checkout@v2

- uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-version }}

# Remove php-cs-fixer until compatible with PHP 8
# This step might be removable if php-cs-fixer is compatible with 8.4 by the time this runs
- run: composer remove --dev --no-update --no-interaction friendsofphp/php-cs-fixer

- run: composer self-update

- run: composer install --no-interaction --prefer-source --dev

- run: composer test

php7-4:
name: Unit Tests php7.4 (php ${{ matrix.php-version }})
runs-on: ubuntu-latest
Expand Down Expand Up @@ -109,4 +139,3 @@ jobs:
- run: composer install --no-interaction --prefer-source --dev

- run: composer test

1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"8.1.27","version":"3.22.0:v3.22.0#92b019f6c8d79aa26349d0db7671d37440dc0ff3","indent":" ","lineEnding":"\n","rules":{"array_syntax":{"syntax":"short"},"no_unused_imports":true,"ordered_imports":{"imports_order":["const","class","function"]},"php_unit_fqcn_annotation":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true},"hashes":{"\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder2419\/examples\/digitalidentity\/app\/Http\/Controllers\/IdentityController.php":"369515522c3efd6cd55a8363d4e97c05","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder4308\/src\/Identity\/Policy\/Policy.php":"e1bca74eaafe5271dd1a38769fe1c3b2","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder3692\/src\/Identity\/Policy\/PolicyBuilder.php":"88302b88aba33563661d4b989b5dc429","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder2054\/tests\/Identity\/Policy\/PolicyBuilderTest.php":"a262a261102744a1acf6d5d0b421dc44","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder5221\/src\/Identity\/ReceiptBuilder.php":"2e6ef33d3401f7cbd36145ad66b3b2ef","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder289\/examples\/digitalidentity\/app\/Http\/Controllers\/ReceiptController.php":"e79ec7e1511895c954f77c713d435ad2","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder2348\/tests\/Identity\/ReceiptTest.php":"b602e6828020fef411df597e17fa7c88","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder4139\/examples\/digitalidentity\/routes\/web.php":"dcdc77843f3e59dd61467a324edf0c77","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder5396\/src\/Identity\/Receipt.php":"4744c8887009fd9ffbf084f99021eb1c","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder5193\/src\/Identity\/WrappedReceipt.php":"3a77a22be093a1da75438ea2bb9fcb20","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder4416\/examples\/digitalidentity\/app\/Http\/Controllers\/AdvancedIdentityController.php":"6b5c23f2ce8da246bc41d136d87ecdb6","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder5544\/examples\/digitalidentity\/app\/Http\/Controllers\/AdvancedIdentityController.php":"6b5c23f2ce8da246bc41d136d87ecdb6","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder4533\/src\/Identity\/Policy\/Policy.php":"bea4b7ebb268fca1ad719f933ec82cbd","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder3559\/tests\/Identity\/Policy\/PolicyBuilderTest.php":"f6d7380ae2db4eca426bb39ccfb3a900","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder2922\/examples\/digitalidentity\/routes\/web.php":"fdf260e4dfd18c8ba12078943564875a","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder3947\/src\/Constants.php":"4bb1127c9665c5d0496b90ea3211951d","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder4440\/src\/Constants.php":"99a3224f6e3fcae067362798bbab64f0","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder4745\/src\/Constants.php":"afc40e02bdc3a87ff7a874826447c604","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder1311\/src\/Constants.php":"77a8a39eac3e973495b7719ebd41509e","\/private\/var\/folders\/b6\/tqq9d7y54ll62fjfysz50ry80000gn\/T\/PHP CS Fixertemp_folder1635\/examples\/digitalidentity\/app\/Http\/Controllers\/ReceiptController.php":"10f70ffe111a0030b29762494cc5de7d"}}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ Add the Yoti SDK dependency:

```json
"require": {
"yoti/yoti-php-sdk" : "^4.1"
"yoti/yoti-php-sdk" : "^4.4.0"
}
```

Or run this Composer command
```console
$ composer require yoti/yoti-php-sdk "^4.1"
$ composer require yoti/yoti-php-sdk "^4.4.0"
```

## Setup
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "yoti/yoti-php-sdk",
"description": "Yoti SDK for quickly integrating your PHP backend with Yoti",
"version": "4.2.2",
"version": "4.4.0",
"keywords": [
"yoti",
"sdk"
],
"homepage": "https://yoti.com",
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0 || ^8.1",
"php": "^7.4 || ^8.0 || ^8.1 || ^8.4",
"ext-json": "*",
"google/protobuf": "^3.10",
"phpseclib/phpseclib": "^3.0",
"guzzlehttp/guzzle": "^7.0",
"psr/http-client": "^1.0",
"psr/http-message": "^1.0",
"psr/http-message": "^2.0",
"guzzlehttp/psr7": "^2.4",
"ext-openssl": "*"
},
Expand Down Expand Up @@ -66,4 +66,4 @@
"phpstan/extension-installer": true
}
}
}
}
7 changes: 5 additions & 2 deletions examples/digitalidentity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ This example requires [Docker](https://docs.docker.com/)
* Visit [https://localhost:4002](https://localhost:4002)
* Run the `docker-compose stop` command to stop the containers.

> To see how to retrieve activity details using the one time use token, refer to the [digitalidentity controller](app/Http/Controllers/IdentityController.php)

> To see how to retrieve a profile using share receipt, refer to the [receipt controller](app/Http/Controllers/ReceiptController.php)
## Digital Identity Example
* Visit [/generate-share](https://localhost:4002/generate-share)
## Digital Identity(Advanced) Share Example
* Visit [/generate-advanced-identity-share](https://localhost:4002/generate-advanced-identity-share)
* ## Digital Identity DBS Example
* Visit [/generate-dbs-share](https://localhost:4002/generate-dbs-share)
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Log;
use mysql_xdevapi\Exception;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Yoti\DigitalIdentityClient;
use Yoti\Identity\Policy\PolicyBuilder;
use Yoti\Identity\ShareSessionRequestBuilder;
use Yoti\YotiClient;

class AdvancedIdentityController extends BaseController
{
Expand Down
53 changes: 53 additions & 0 deletions examples/digitalidentity/app/Http/Controllers/DbsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Yoti\DigitalIdentityClient;
use Yoti\Identity\Policy\PolicyBuilder;
use Yoti\Identity\ShareSessionRequestBuilder;

class DbsController extends BaseController
{
public function generateSession(DigitalIdentityClient $client)
{
try {
$policy = (new PolicyBuilder())
->withIdentityProfileRequirements((object)[
'trust_framework' => 'UK_TFIDA',
'scheme' => [
'type' => 'DBS',
'objective' => 'BASIC'
]
])
->build();

$redirectUri = 'https://host/redirect/';

$shareSessionRequest = (new ShareSessionRequestBuilder())
->withPolicy($policy)
->withRedirectUri($redirectUri)
->build();
$session = $client->createShareSession($shareSessionRequest);
return $session->getId();
}
catch (\Throwable $e) {
Log::error($e->getTraceAsString());
throw new BadRequestHttpException($e->getMessage());
}
}
public function show(DigitalIdentityClient $client)
{
try {
return view('dbs', [
'title' => 'Digital Identity DBS Check Example',
'sdkId' => $client->id
]);
} catch (\Throwable $e) {
Log::error($e->getTraceAsString());
throw new BadRequestHttpException($e->getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Log;
use mysql_xdevapi\Exception;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Yoti\DigitalIdentityClient;
use Yoti\Identity\Policy\PolicyBuilder;
use Yoti\Identity\ShareSessionRequestBuilder;
use Yoti\YotiClient;

class IdentityController extends BaseController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace App\Http\Controllers;

use Yoti\DigitalIdentityClient;
use Yoti\YotiClient;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Yoti\Profile\Attribute;
use Yoti\Profile\UserProfile;
use Yoti\Util\Logger;

class ReceiptController extends BaseController
{
public function show(Request $request, DigitalIdentityClient $client, ?LoggerInterface $logger = null)
Expand All @@ -17,14 +17,25 @@ public function show(Request $request, DigitalIdentityClient $client, ?LoggerInt

$logger->warning("Unknown Content Type parsing as a String");
$shareReceipt = $client->fetchShareReceipt($request->query('ReceiptID'));

$profile = $shareReceipt->getProfile();

return view('receipt', [
'fullName' => $profile->getFullName(),
'selfie' => $profile->getSelfie(),
'profileAttributes' => $this->createAttributesDisplayList($profile),
]);
if ($shareReceipt->getError() != null)
{
error_log($shareReceipt->getErrorReason()->getRequirementNotMetDetails()->getDocumentCountryIsoCode());
return view('receipt', [
'fullName' => null,
'selfie' => null,
'profileAttributes' => null,
'error' => $shareReceipt->getErrorReason()
]);
}
else {
$profile = $shareReceipt->getProfile();
return view('receipt', [
'fullName' => $profile->getFullName(),
'selfie' => $profile->getSelfie(),
'profileAttributes' => $this->createAttributesDisplayList($profile),
'error' => null
]);
}
}

/**
Expand Down
90 changes: 90 additions & 0 deletions examples/digitalidentity/resources/views/dbs.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html class="yoti-html">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{{ $title }}</title>
<link rel="stylesheet" type="text/css" href="assets/css/index.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
</head>

<body class="yoti-body">
<main>
<section class="yoti-top-section">
<div class="yoti-logo-section">
<a href="https://www.yoti.com" target="_blank">
<img class="yoti-logo-image" src="assets/images/logo.png" srcset="assets/images/[email protected] 2x"
alt="Yoti"/>
</a>
</div>
<h1 class="yoti-top-header">Digital Identity DBS Ckeck Example</h1>

<div class="yoti-sdk-integration-section">
<div id="webshare-target"></div>
</div>

</section>

<section class="yoti-sponsor-app-section">
<h3 class="yoti-sponsor-app-header">The Yoti app is free to download and use:</h3>

<div class="yoti-store-buttons-section">
<a href="https://itunes.apple.com/us/app/yoti/id983980808?ls=1&mt=8" class="yoti-app-button-link">
<img src="assets/images/app-store-badge.png"
srcset="assets/images/[email protected] 2x"
alt="Download on the App Store" />
</a>

<a href="https://play.google.com/store/apps/details?id=com.yoti.mobile.android.live" class="yoti-app-button-link">
<img src="assets/images/google-play-badge.png"
srcset="assets/images/[email protected] 2x"
alt="get it on Google Play" />
</a>
</div>
</section>
</main>
<script>async function onSessionIdResolver() {
const response = await fetch('/generate-advanced-identity-session');
if (!response.ok) {
throw new Error('Response was not ok');
}
const result = await response.text();
console.log("session id %s", result);
return result;
}

async function completionHandler(receivedReceiptId) {
console.log('completion handler:', receivedReceiptId)
const url = '/receipt-info?ReceiptID=' + encodeURIComponent(receivedReceiptId);
window.location.href = url;
}

function onErrorListener(...data) {
console.warn('onErrorListener:', ...data)
}

async function onReadyToStart() {
const { Yoti } = window
await Yoti.createWebShare({
name: 'Use Yoti',
domId: 'webshare-target',
sdkId: '{{$sdkId}}',
hooks: {
sessionIdResolver: onSessionIdResolver,
errorListener: onErrorListener,
completionHandler,
},
flow: "REVEAL_MODAL"
})
}

async function onClientLoaded() {
const { Yoti } = window
await Yoti.ready()
await onReadyToStart()
}</script>
<script src="https://www.yoti.com/share/client/v2" onload="onClientLoaded()"></script>

</body>
</html>
Loading
Loading