Learn the basics on how to integrate Signaturit's API into your system.
In this short tutorial we will guide you step by step to create a simple integration.
Before diving into the code, you will need to setup your environment to create your PHP web application.
1. Text Editor:
First of all, you will need a text editor in order to code this tutorial. We recommend you to download Atom Editor for free.
To execute PHP code you will need to install the language and a web server to create the webpage. XAMPP is a prepared package that includes the language PHP, Apache Web Server and MySQL
database (you will not need this for this tutorial, but it’s already included in the bundle).
Download XAMPP from their website.
Composer is a package manager for PHP. It allows you to install a lot of libraries that are available online, ready to be downloaded and used in your projects.
Download Composer and follow the screen instructions.
4. Signaturit's PHP SDK:
You will need this to create the "send.php" script that will create the API request to Signaturit. This will also help to speed up the integration process with our platform.
5. Signaturit's basics:
1. Test the XAMPP installation:
To test it, use the text editor to create a file named info.php in: c:\xampp\htdocs\info.php with the content below:
Open your browser and go to http://localhost/info.php. You should see something like:
This confirms that PHP and XAMPP are installed successfully and you can start working in the integration.
2. Create your project folder:
Create a folder in C:\xampp\htdocs with the name “Signaturit”. This is the folder where we are going to
place our files.
3. Create your HTML form:
In your text editor, create a new file called “index.html” and copy the content below:
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<h3>Please fill-out the following form:</h3>
<form method="post" action="send.php">
First name: <input type="text" name="name" />
Email Address: <input type="text" name="email" />
<input type="submit" value="Submit" />
This is a simple form that will submit in "send.php" the information stated in the fields.
4. Install the composer:
Create a file named “composer.json” in the project's folder with the following content:
Now, open the Command Prompt and go to the project's folder.
Execute the command “composer install”.
If everything goes well, you will see a new folder called “vendor” in the Signaturit folder.
5. Create the "send.php" file:
The "send.php" file will handle the information submitted in the HTML form and will send it to Signaturit.
Create a file called "send.php" with this content and save it in your project's folder.
$client = new Signaturit\Client('your_api_token');
$response = $client->createSignature(
'email' => $_POST['email'],
'templates' => ['#test'],
'delivery_type' => 'url',
<meta http-equiv="content-type" content="text/html"; charset="utf-8">
<h3>Please sign the document:</h3>
<iframe src="<?php echo $response['url'] ?>" width="800" height="600"</iframe>
6. Create a template:
Create a template in Signaturit and name it "#test". Check this tutorial to know how to create a template.
This will be the test document to be signed.
TEST YOUR CODE
Go to http://localhost/signaturit and check the results.
Fill-out the information and click on "Submit". You will see the #test document template ready to be signed.
- HTML Form:
- Signing application: