2017 © Pedro Peláez
 

library yousign-api-laravel

Package for using YousignApi with laravel 5.x

image

nidrax69/yousign-api-laravel

Package for using YousignApi with laravel 5.x

  • Friday, March 30, 2018
  • by nidrax
  • Repository
  • 1 Watchers
  • 0 Stars
  • 661 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

YouSignApiLaravel

Latest Stable Version Total Downloads Latest Unstable Version License Donate, (*1)

It's a library for Laravel 7 and PHP7 Not tested on previous version., (*2)

Library to use YouSign API from doc (dev.yousign.com) with Laravel, (*3)

Installation

Install using composer, (*4)

Now require the lib, (*5)

composer require nidrax69/yousign-api-laravel

Add provider in config.app, (*6)

'providers' => [
    Nidrax69\YousignApiLaravel\YousignApiLaravelServiceProvider::class,
];

'aliases' => [
    'YousignApiLaravel' => Nidrax69\YousignApiLaravel\Facade\YousignApiLaravel::class,
];

Complete informations inside your .env file (contact YouSign to get Credentials) and then, (*7)

YOUSIGN_KEY=
YOUSIGN_API_URL=

Usage

Create Procedure with webhooks , files and members, (*8)

use Nidrax69\YousignApiLaravel\YousignApiLaravel;

class DocumentController extends Controller
{

  public function sign(Request $request) {
    $client = new YousignApiLaravel();

    // see all possibilities at https://dev.yousign.com/
    $client->setProcedureKeyValue('name', 'Yousign');
    $client->setProcedureKeyValue('description', 'Description procedure');
    // to set default expiration date to the signature
    $client->setProcedureKeyValue('expiresAt', '2022-04-24');

    // add webhooks 
    // you can add different headers
    $webhookUrl = env('API_URL') . 'yousign/';
    $client->addWebhook('member.finished', $webhookUrl . 'signature', 'GET', array(
        "X-Custom-Header" => $type . '-signature',
    ));
    $client->addWebhook('procedure.refused', $webhookUrl . 'refused', 'GET', array(
        "X-Custom-Header" => $type . '-signature',
    ));
    // procedure created but not ready for signature
    $procedure = $client->createProcedure();

    // Allows you to define the content of SMS. {{code}} will be used to define the security code managed by Yousign.
    // up to 150 characters
    $client->addSmsContent('DIGITAL SIGNATURE - {{code}} is your security code to sign your documents.');

    // add files to procedure
    $file = $client->addFile($namefile, $document->url, $procedure['id']);

    // add member to sign the documents
    $member = $client->addMember($user->firstname, $user->lastname, $user->email, $user->phone, $procedure['id']);

    // to determine the last page of your file
    $lastPageNumber = $this->getNumPagesInPDF($document->url);

    $reason = "Signed by " . $user->firstname . " " . $user->lastname . " (Yousign)";

    // to determine position see https://placeit.yousign.fr/
    $fileObject = $client->addFileObject($file['id'], $member['id'], $position, $reason, $lastPageNumber);

    // start the signature process
    $client->launchProcedure($procedure['id']);
  }
}

Find the complete integration in source file, (*9)

The Versions

30/03 2018

dev-master

9999999-dev

Package for using YousignApi with laravel 5.x

  Sources   Download

MIT

The Requires

 

by Avatar nidrax

09/01 2018

0.0.1

0.0.1.0

Package for using YousignApi with laravel 5.x

  Sources   Download

MIT

The Requires

 

by Avatar nidrax