1. Go to this page and download the library: Download oanna/laravel-onfido 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/ */
oanna / laravel-onfido example snippets
class User extends \Illuminate\Database\Eloquent\Model
{
use \OANNA\Onfido\Traits\Verifiable; // Use it here to be able to verify your model
/*...*/
}
use OANNA\Onfido\Repositories\OnfidoRepository;
use Onfido\Region;
$repo = new OnfidoRepository($user);
$repo->startVerification(Region::EU, $user->getOnfidoAttributes());
public function onfidoInstance()
{
return $this->morphOne(OnfidoInstance::class, 'model');
}
use OANNA\Onfido\OnfidoManager;
use App\Models\MyModel;
public function boot(): void
{
/*...*/
OnfidoManager::registerOnfidoModel(MyModel::class);
/*...*/
}
$this->execute(function () use ($applicant, $workflow) {
$workflowRunBuilder = new WorkflowRunBuilder([
'applicant_id' => $applicant,
'workflow_id' => $workflow,
]);
$workflowRun = $this->api->createWorkflowRun($workflowRunBuilder);
if ($workflowRun instanceof Error) {
throw new ApiException($workflowRun->getError());
}
return $workflowRun;
});
use OANNA\Onfido\Api\Portal;
use Onfido\Region;
$portal = Portal::initialize()
->setApiToken('<YOUR_API_TOKEN>') // Optional
->setRegion(Region::EU);
bash
php artisan onfido:install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.