PHP code example of blackit / privyid

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

    

blackit / privyid example snippets


return [

    ...

    'providers' => [

        ...
        \BlackIT\PrivyID\PrivyIDServiceProvider::class

    ],

    ...

    'aliases' => [

        ...
        'File' => Illuminate\Support\Facades\File::class,
        'PrivyID' => \BlackIT\PrivyID\PrivyIDFacade::class,

    ],

];


namespace App;

use BlackIT\PrivyID\PrivyIDAble;

class User 
{
    use PrivyIDAble;
    
    ...
}

namespace App\Http\Controllers;

use App\User;
use BlackIT\PrivyID\PrivyID;
use Illuminate\Http\Request;

class DigitalSignatureController extends Controller
{
    public function privyid(Request $request) {
        $code = $request->input('code');
        if ($code != '') {
            /**
             * @var $user User
             */
            $user = \Auth::user();

            try {
                $user->bind($code);
            } catch (\Exception $e) {
                \Toast::error('Gagal integrasi dengan Privy ID silahkan klik tombol bind kembali');
            }
        }
    }
}

    public function getIdentity(Request $request)
    {

        $user = Auth::user();
        $user->updateIdentity();
        $identity = $user->privyid();
        ...

    }

    public function uploadDocument(Request $request)
    {

        $user = Auth::user();
        ...
        $recipientBuilder = new PrivyIDRecipientBuilder();
        $recipientBuilder->addRecipient('PRIVYID', 'Signer');
        
        $checkUploadPrivy = $user->uploadDocument('CODE Document', 'Title Document', 'Parallel/Serial', 'File Location', $recipientBuilder->output());

    }
bash
php artisan vendor:publish --provider="BlackIT\PrivyID\PrivyIDServiceProvider"
php artisan migrate
bash
php artisan config:clear