/hellosign-laravel

A Laravel wrapper for HelloSign's PHP SDK

Primary LanguagePHPMIT LicenseMIT

HelloSign Laravel

Latest Version on Packagist Total Downloads Build Status StyleCI

This package acts as a wrapper, for the HelloSign PHP SDK, to inject the relevant credentials and allow you to use the package in the container. Some examples of usage have been provided below.

See the HelloSign PHP SDK for full details.

Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require industrious/hellosign-laravel

Usage

Publish the config, and add the relevant API authentication details to your .env file.

php artisan vendor:publish --tag=laravel-hellosign

Examples

Get client account details

/**
 * @param  HelloSignLaravel\Client $client
 */
public function client(Client $client)
{
    $client = $client->getAccount();
    
    ...

Send a signature request

/**
 * @param  HelloSignLaravel\Classes\SignatureRequest $signature_request
 */
public function sign(SignatureRequest $signature_request)
{
    $request = $signature_request
        ->setTitle('Title')
        ->setSubject('Subject')
        ->setMessage('Message')
        ->addSigner('email@address.com', 'Client name');

    $file = storage_path('app/file.pdf');

    $request->addFile($file);

    $response = $request->send();
    
    ...

Send a signature request using a pre-defined template

/**
 * @param  HelloSignLaravel\Classes\SignatureRequest $signature_request
 */
public function templateSign(TemplateSignatureRequest $signature_request)
{
    $request = $signature_request
        ->setTemplateId(config('hellosign.templates.contract'))
        ->setTitle('Title')
        ->setSubject('Subject')
        ->setMessage('Message')
        ->setSigner('Client', 'email@address.com', 'Test User');

    $request->setCustomFieldValue('Name', 'Test User');

    $response = $request->send();

    ...

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email christian@industrious.agency instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.