easy-yousign
provide an easy way to use YouSign API. Modern, tested and fully written in php.
Written here at easyblue.io, a french insurtech company. Check out our website to see how we're using this package in production.
Install this package as a dependency using Composer.
composer require easyblue/easy-yousign
Procedure
and File
are supporting for basic mode but you can do a pull request to improve this library.
use Easyblue\YouSign\Factory\Factory;
use Easyblue\YouSign\Model\File;
use Easyblue\YouSign\Model\FileObject;
use Easyblue\YouSign\Model\Member;
use Easyblue\YouSign\Model\Procedure;
use Easyblue\YouSign\Http\Client;
$ysApiKey = 'test';
$factory = new Factory($ysApiKey, Client::ENV_STAGING);
$member = (new Member())
->setFirstname('John')
->setLastname('Doe')
->setEmail('j.doe@domain.com')
->setPhone('+33611111111');
$file = (new File())
->setName('my_file.pdf')
->setContent('base64 content');
$file = $factory->file()->create();
$fileObject = (new FileObject())
->setFile($file)
->setPage(1)
->setPosition('230,499,464,589');
$member->addFileObject($fileObject);
$procedure = (new Procedure())->setName('My first procedure')
->setDescription('Awesome! Here is the description of my first procedure')
->addMember($member);
$procedure = $factory->procedure()->create($procedure);
use Easyblue\YouSign\Factory\Factory;
use Easyblue\YouSign\Model\Procedure;
use Easyblue\YouSign\Http\Client;
$ysApiKey = 'test';
$factory = new Factory($ysApiKey, Client::ENV_STAGING);
/** Procedure $procedure **/
$procedure = $factory->procedure()->get('/procedures/9d1ede2b-5687-4440-bdc8-dd0bc64f668c');
use Easyblue\YouSign\Factory\Factory;
use Easyblue\YouSign\Model\File;
use Easyblue\YouSign\Http\Client;
$ysApiKey = 'test';
$factory = new Factory($ysApiKey/*, Client::ENV_STAGING*/);
// Pdf content as binary file
$content = $factory->file()->download('/files/9d1ede2b-5687-4440-bdc8-dd0bc64f668c');
// Pdf content as base64
$content = $factory->file()->download('/files/9d1ede2b-5687-4440-bdc8-dd0bc64f668c', false);
Contributions are welcome! Before contributing to this project, familiarize yourself with CONTRIBUTING.md.
To develop this project, you will need PHP 7.4 or greater, Composer and make.
After cloning this repository locally, execute the following commands:
cd /path/to/repository
composer install
Now, you are ready to develop!
This project follows a superset of PSR-12
coding standards, enforced by PHP-CS-Fixer.
The project PHP_CodeSniffer configuration may be found in .php_cs
.
You may lint the entire codebase using PHP-CS-Fixer with the following commands:
make php-cs-fixer
This project uses a combination of PHPStan, phpmd, phpcpd to provide static analysis of PHP
code. Configurations for these are in phpstan.neon.dist
, .phpmd.xml
.
respectively.
You may run static analysis manually across the whole codebase with the following command:
# Static analysis
make phpspan
make phpmd
make phpcpd
This project use composer-git-hooks. It will attempt to fix any errors it can, and it will reject the commit if there are any un-fixable issues. Many issues can be fixed automatically and will be done so pre-commit.
vendor/bin/cghooks add
This project uses pds/skeleton as its base folder structure and layout.
Name | Description |
---|---|
bin/ | Commands and scripts for this project |
build/ | Cache, logs, reports, etc. for project builds |
docs/ | Project-specific documentation |
resources/ | Additional resources for this project |
src/ | Project library and application source code |
tests/ | Tests for this project |
The easyblue/easy-yousign library is copyright © easyblue and licensed for use under the terms of the MIT License (MIT). Please see LICENSE for more information.