AUTENTIQUE Api v2
🚀
Usage
This package is so simple to use that it will save your time.
composer require vinicinbgs/autentique-v2
⚠️
IMPORTANT
This library depends on vlucas/phpdotenv to get environments variables (.env)
If you use a framework like Laravel, you don't need to download this library.
composer require vlucas/phpdotenv
Set in file .env
AUTENTIQUE_URL=https://api.autentique.com.br/v2/graphql
AUTENTIQUE_TOKEN="YOUR_TOKEN"
AUTENTIQUE_DEV_MODE="true" || "false"
# if TRUE, document will be created in mode sandbox
Instance
Import library
use vinicinbgs\Autentique\Documents;
$AUTENTIQUE_TOKEN="xxxxxxxx" (set or will be take in .env)
$documents = new Documents($AUTENTIQUE_TOKEN);
$folders = new Folders($AUTENTIQUE_TOKEN);
Why documents/folders receive token?
- Easily to manage Documents in multiples accounts (token)
📝
Documents
1 - List all documents with pagination
$documentsPaginated = documents->listAll($page); // if not isset $page is equal 1
2 - List the document by id
$document = $documents->listById($documentId);
3 - Create a document
$attributes = [
'document' => [
'name' => 'NOME DO DOCUMENTO',
],
'signers' => [
[
'email' => '[email protected]',
'action' => 'SIGN',
'positions' => [
[
'x' => '50', // Posição do Eixo X da ASSINATURA (0 a 100)
'y' => '80', // Posição do Eixo Y da ASSINATURA (0 a 100)
'z' => '1', // Página da ASSINATURA
],
[
'x' => '50', // Posição do Eixo X da ASSINATURA (0 a 100)
'y' => '50', // Posição do Eixo Y da ASSINATURA (0 a 100)
'z' => '2', // Página da ASSINATURA
],
],
],
[
'email' => '[email protected]',
'action' => 'SIGN',
'positions' => [
[
'x' => '50', // Posição do Eixo X da ASSINATURA (0 a 100)
'y' => '80', // Posição do Eixo Y da ASSINATURA (0 a 100)
'z' => '1', // Página da ASSINATURA
],
[
'x' => '50', // Posição do Eixo X da ASSINATURA (0 a 100)
'y' => '50', // Posição do Eixo Y da ASSINATURA (0 a 100)
'z' => '2', // Página da ASSINATURA
],
],
],
],
'file' => './dummy.pdf',
];
$documentCreated = $documents->create($attributes);
4 - Sign the document by id
$documentSign = $documents->signById($documentId);
5 - Delete the document by id
$documentDeleted = $documents->deleteById($documentId);
📁
Folders
1 - List all folders
$foldersPaginated = folders->listAll($page); // if not isset $page is equal 1
2 - List the folder by id
$folder = $folders->listById($folderId);
3 - Create a folder
$attributes = [
"folder" => [
"name" => "folder name",
],
];
$folder = $folders->create($attributes);
4 - List the folder contents by id
$folderContents = $folders->listContentsById($folderId, $page = 1);
5 - Delete a folder
$folderDeleted = $folders->deleteById($folderId);
🔧
Contributing
💻
Setup
git clone [email protected]:vinicinbgs/autentique-v2.git
cd autentique-v2
composer install
npm install
⚙️
Configure
Create .env with variables
./contribute.sh
Configure prettier php in vscode
(CTRL + P) > Preferences: Open Setting (JSON)
"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.php$",
"cmd": "npm run prettier -- ${relativeFile} --write",
},
]
}