picoss/yousign-bundle
Composer 安装命令:
composer require picoss/yousign-bundle
包简介
Symfony2 YouSign bundle
README 文档
README
This bundle provides integration for Yousign in your Symfony2 Project.
License: MIT
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:
$ composer require picoss/yousign-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
2: Enable the Bundle
When using Flex, this step is handled automatically.
Then, enable the bundle by adding the following line in the app/AppKernel.php
file of your project:
// 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:
# 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
4: Usage
4.1: Test API connection
The following example shows how to test the connection to the Yousign API in your controller
<?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
picoss/yousign-bundle 适用场景与选型建议
picoss/yousign-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.76k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 02 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Symfony2」 「bundle」 「yousign」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 picoss/yousign-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 picoss/yousign-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 picoss/yousign-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
Yousign Bundle for Symfony
The bundle for easy using json-rpc api on your project
A PHP implementation of YouSign API.
Provide a way to secure accesses to all routes of an symfony application.
DMS Meetup API Bundle, enables Meetup API clients in services
统计信息
- 总下载量: 6.76k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-08