2017 © Pedro Peláez
 

symfony-bundle yousign-bundle

Symfony2 YouSign bundle

image

picoss/yousign-bundle

Symfony2 YouSign bundle

  • Thursday, February 15, 2018
  • by picoss
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,012 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 11 Versions
  • 11 % Grown

The README.md

Yousign Bundle for Symfony2

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

This bundle provides integration for Yousign in your Symfony2 Project., (*2)

License: MIT, (*3)

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*4)

    $ composer require picoss/yousign-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*5)

2: Enable the Bundle

When using Flex, this step is handled automatically., (*6)

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:, (*7)


// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Picoss\YousignBundle\PicossYousignBundle(), ); // ... } // ... }

3: Configure the bundle

# config/packages/picoss_yousign.yml
picoss_yousign:
    env: demo #demo or prod
    api_key: yousign_api_key
    username: yousign_username
    password: yousign_password

Note: If you need to pass some options to the saop client, add soap_options config:, (*8)

# config/packages/picoss_yousign.yml
picoss_yousign:
    env: demo #demo or prod
    api_key: yousign_api_key
    username: yousign_username
    password: yousign_password
    soap_options:
        trace: 1

Check $options argument of the soap client to see available options : http://php.net/manual/en/soapclient.soapclient.php, (*9)

4: Usage

4.1: Test API connection

The following example shows how to test the connection to the Yousign API in your controller, (*10)

<?php

namespace App\Controller;

use Picoss\YousignBundle\Yousign\YousignApi;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class TestController extends Controller
{
    /**
     * @Route("/test", name="test")
     */
    public function index(YousignApi $api)
    {
        $auth = $api->authentication;

        $result = $auth->connect() ? 'Connected' : 'Enable to connect';

        $response = new Response();
        $response->setContent(sprintf('<html><body>%s</body></html>', $result));

        return $response;
    }
}

4.2: Create a signature demand

<?php

namespace App\Controller;

use Picoss\YousignBundle\Model\Cosigner;
use Picoss\YousignBundle\Model\Demand;
use Picoss\YousignBundle\Model\File;
use Picoss\YousignBundle\Yousign\YousignApi;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class TestController extends Controller
{
    /**
     * @Route("/test", name="test")
     */
    public function index(YousignApi $api)
    {
        $signatureApi = $api->signature;

        $file = new File();
        $file
            ->setName('My PDF Filename')
            ->setContent(file_get_contents('/path/to/the/file.pdf'))
        ;

        $cosigner = new Cosigner();
        $cosigner
            ->setFirstName('John')
            ->setLastName('Doe')
            ->setMail('john.doe@email.com')
            ->setAuthenticationMode('mail');

        $visibleOptions = array(
            'visibleSignaturePage' => '5',
            'isVisibleSignature' => true,
            'visibleRectangleSignature' => '10,10,10,10',
        );

        $demand = new Demand();
        $demand
            ->addFile($file, $visibleOptions)
            ->addCosigner($cosigner)
        ;

        $signature = $signatureApi->initCosign($demand);

        $response = new Response();
        $response->setContent(sprintf('<html><body>Signature demand id: %s</body></html>', $signature->getIdDemand()));

        return $response;
    }
}

4.3: Available methods

4.3.1: Authentication API

Methods Description Return
connect() Check API connection boolean

4.3.2: Signature API

Methods Description Return
initCosign() Initialize a signature demand Picoss\YousignBundle\Model\Signature
getCosignedFilesFromDemand() Get files from demand id Picoss\YousignBundle\Model\File[]
getInfosFromCosignatureDemand() Get signature informations Picoss\YousignBundle\Model\Signature
getListCosign() Search for signatures demand Picoss\YousignBundle\Model\Signature[]
cancelCosignatureDemand() Cancel a signature process boolean
alertCosigners() Alter cosigners boolean
isPDFSignable() Check if the given PDF is signable boolean
updateCosigner() Update a cosigner informations boolean

For more informations, please visite Yousign API documentation, (*11)

The Versions

15/02 2018

dev-master

9999999-dev

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Romain Honel

symfony2 bundle yousign

15/02 2018

2.x-dev

2.9999999.9999999.9999999-dev

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Romain Honel

symfony2 bundle yousign

15/02 2018
17/06 2016

1.3.3

1.3.3.0

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign

17/06 2016

1.x-dev

1.9999999.9999999.9999999-dev

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign

06/05 2016

1.3.2

1.3.2.0

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign

02/03 2016

1.3.1

1.3.1.0

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign

18/02 2016

1.3

1.3.0.0

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign

17/02 2016

1.2.1

1.2.1.0

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign

16/02 2016

1.2

1.2.0.0

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign

12/02 2016

1.0

1.0.0.0

Symfony2 YouSign bundle

  Sources   Download

MIT

The Requires

 

by Romain Honel

symfony2 bundle yousign