1. Go to this page and download the library: Download picoss/yousign-bundle 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/ */
picoss / yousign-bundle example snippets
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Picoss\YousignBundle\PicossYousignBundle(),
);
// ...
}
// ...
}
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;
}
}
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('[email protected]')
->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;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.