Posted under PHP
Permalink
Tags Yoti
Although I was deploying an Angular app for this, it is a Yoti requirement that some interaction with Yoti is done via a backend.
As I wanted to deploy under cPanel with Zen for demo purposes, my only backend option was php.
I therefore planned a simple php backend web service that could be called from the Angular app to do the required Yoti backend functionality.
To develop and test this locally I installed a local WAMP server – details of this may be found on this post here.
Having installed Wamp64 and got working ok, I was able to run microapp demos locally with Angular deployments, and to run a simple ‘hello world’ php backend, by renaming index.html to .php and inserting the php code.
Next I needed to install composer and set up a composer.json to handle dependency loading as Yoti needs this.
Composer is a commonly used dependency management tool for PHP and full details and the download for it may be found here.
I had some issues getting Composer to co-operate with Wamp64, regarding the PHP version. In particular it gave errors on the PHP version when loading the Yoti SDK, which I initially assumed were due to not having a recent enough version of php for the latest Yoti SDK. However, in the end, this was not the case – it was purely a local Composer/Wamp64 integration issue.
This post here offers help on this. I ended up adding the correct PHP version to the system path, which kept Composer happy and in my case, unlike other posters in the previous post, did not upset Wamp64.
I was ultimately able to use php 5.6.40 with the latest 2.4 Yoti SDK with no problems – this was helpful as this was the version currently in use on the target Zen cPanel hosting.
I then installed the latest eclipse for PHP, as I did not want to upgrade my webstorm to PHPStorm just for a simple PHP requirement.
It was however useful having the eclipse ability to provide a decent PHP editor in its IDE.
When creating a workspace and project, I was offered Composer integration by eclipse, which initially seemed attractive.
However, this proved somewhat complex to get into, given I had no intention of building my own Composer packages. The only reason I wanted it was to allow loading of the Yoti SDK via Composer, as this would be called from my simple php backend.
I therefore dumped this and used a basic PHP project in eclipse. I manually created the composer.json file per Yoti’s instructions, and a simple manual “composer install” command from the command line in the project directory caused the SDK to be downloaded and correctly placed under the vendor subfolder, which also needed deploying along with the api code.
Having fixed all the issues along the way which are documented in my wamp server installation post above, I was able to fully integrate with Yoti both locally and from Zen cPanel hosting. My simple initial test PHP backend was taken from the Yoti samples, and successfully displayed the user’s date of birth, obtained from the live Yoti integration, after its Yoti button was clicked and the QR code scanned via the mobile Yoti app.
Comments Off on Integrating the Yoti backend via PHP under cPanel