Skip to content

Commit

Permalink
Release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JiSoft committed Jan 22, 2024
0 parents commit a91422b
Show file tree
Hide file tree
Showing 101 changed files with 12,361 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
55 changes: 55 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Laravel Application
APP_NAME=signNow-sample-app
APP_ENV=local
APP_KEY=base64:5p163GaUCTKweRDAIheB4dhLHFGH6gakIhB3N6qeWvo=
APP_DEBUG=true
APP_URL=http://localhost:8080

# Log
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

# Database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

# Files and Cache
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1

# Redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

# Amazon Web Services (optional)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

# signNow API configuration
#
# The following values are provided as examples and are not real.
# Please provide your actual signNow API credentials below.
#
# The API host does not need to be changed.
SN_API_HOST=https://api.signnow.com
# Find your basic authorization token at API Dashboard (https://app.signnow.com/webapp/api-dashboard/keys).
SN_API_BASIC_TOKEN=c2lnbk5vdyBBUEkgc2FtcGxlIEFwcCB2MS4wCg==
# The email address that your signNow account is registered with.
SN_API_USER=[email protected]
# Your signNow account password.
SN_API_PASSWORD=****
# The email address of the person who is supposed to sign a document.
SN_SIGNER_EMAIL=[email protected]
34 changes: 34 additions & 0 deletions .env.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
APP_NAME=signNow-sample-app
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8080

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/vendor/
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/framework/cache/*
/storage/framework/sessions/*
/storage/framework/views/*
/storage/logs/*
/bootstrap/cache/*
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
/.netbeans

32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM php:8.2-fpm

COPY . /app

RUN apt-get update && apt-get install -y \
git \
nginx \
supervisor \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libtidy-dev \
libzip-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd pdo_mysql exif tidy zip \
&& curl -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --filename=composer --version=2.6.5 \
&& chmod +x /usr/local/bin/composer \
&& cp -R /app/docker/nginx/* /etc/nginx/ \
&& cp /app/docker/php/app.ini /usr/local/etc/php/conf.d/php.ini \
&& cp /app/docker/supervisor/supervisor.conf /etc/supervisor/conf.d/supervisor.conf \
&& cp /app/docker/provision/entrypoint.sh /entrypoint.sh

RUN bash /app/docker/provision/after-build.sh

EXPOSE 80 9000

WORKDIR /app

ENTRYPOINT ["/entrypoint.sh"]

CMD ["/usr/bin/supervisord"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2024 airSlate, Inc. (https://www.signnow.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.PHONY: build up setup down clear setup-env

build:
@docker-compose build --no-cache --force-rm

up:
@docker-compose up -d

setup:
@docker exec -it signnow-sample-app composer install --ignore-platform-reqs --no-dev
@test -f .env || cp .env.src .env
@docker exec -it signnow-sample-app php artisan key:generate
@make setup-env

down:
@docker-compose down -v

clear:
@docker exec -it signnow-sample-app php artisan cache:clear
@docker exec -it signnow-sample-app php artisan config:clear
@docker exec -it signnow-sample-app php artisan route:clear
@docker exec -it signnow-sample-app php artisan view:clear
@docker exec -it signnow-sample-app php artisan optimize:clear

setup-env:
@echo "\nPlease configure your sample application with required information:"; \
read -p "signNow API host: " sn_api_host; \
read -p "signNow application's basic token: " sn_basic_token; \
read -p "Your signer's email: " sn_signer_emal; \
read -p "Your login to signNow account: " sn_user; \
read -p "Your password to signNow account: " sn_password; \
echo "\n" >> .env; \
echo "SN_API_HOST=$$sn_api_host" >> .env; \
echo "SN_API_BASIC_TOKEN=$$sn_basic_token" >> .env; \
echo "SN_API_USER=$$sn_user" >> .env; \
echo "SN_API_PASSWORD=$$sn_password" >> .env; \
echo "SN_SIGNER_EMAIL=$$sn_signer_emal" >> .env; \
echo "\n" >> .env; \
echo "Setup completed."
103 changes: 103 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# signNow Sample App

[![PHP Version](https://img.shields.io/badge/php->=8.2-blue)](https://php.net/)
[![Laravel Version](https://img.shields.io/badge/laravel-10-cyan)](https://laravel.com/)
[![signNow PHP SDK](https://img.shields.io/badge/signNow_SDK-2.2-light)](https://github.com/signnow/SignNowPHPSDK)
[![Licence](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
## About

This sample application demonstrates how the signNow API and PHP SDK can be used to construct applications with signing flows. This sample application operates using the following features:

* [Authentication](https://docs.signnow.com/docs/signnow/reference%2Foperations%2Fcreate-a-oauth-2-token)
* [Upload document](https://docs.signnow.com/docs/signnow/branches/v1.2/reference%2Foperations%2Fcreate-a-document)
* [Add fillable fields](https://docs.signnow.com/docs/signnow/branches/v1.2/reference/operations/update-a-document-document-id-adds-fields-to-a-document)
* [Embedded signing](https://docs.signnow.com/docs/signnow/guides-embedded-signing)

Try using the sample application for testing purposes or use it as a skeleton for your own application. To create an application that generates legally binding signatures, you’ll need a signNow subscription.

## Prerequisites

* Create a signNow account:
* For integration purposes, you need a signNow account with a paid subscription.
* For testing purposes, you can [create](https://www.signnow.com/developers) a signNow developer account.
* At the [API Dashboard](https://app.signnow.com/webapp/api-dashboard/keys), create an application.
* Use your signNow credentials and basic authorization token in your config file `.env`.

## Environment variables

The configuration file is located in the project directory with the common name `.env`.

Configure the following variables to ensure the application’s proper functionality.

| Variable | Example | Description |
|--------------------|--------------------------------------------|------------------------------------------------------------------------------------------------|
| SN_API_HOST | `https://api.signnow.com` | signNow API host |
| SN_API_BASIC_TOKEN | `c2lnbk5vdyBBUEkgc2FtcGxlIEFwcCB2MS4wCg==` | Find your basic token at the [API Dashboard](https://app.signnow.com/webapp/api-dashboard/keys). |
| SN_API_USER | `[email protected]` | The email address of the document signer. |
| SN_API_PASSWORD | `*****` | Your signNow account password. |
| SN_SIGNER_EMAIL | `[email protected]` | The email address of the person who is supposed to sign a document. |

View the entire configuration file, including standard Laravel variables, [here](./.env.example).

## Get Started
1. Clone the repository
```
git clone [email protected]:signnow/sample-app.git
```

2. Build a docker image using the following command:

```
make build
```

3. Start the `signnow-sample-app` docker container using the following command:

```
make up
```

4. Install dependencies and generate a Laravel application key using the following command:

```
make setup
```
This command will also prepare your configuration `.env` file and prompt you to enter all the required parameters. Make sure that you have the following data at hand:
- Basic token for your application.
- The email address that your signNow account is registered with.
- Your signNow password.
- The email address of the person who is supposed to sign a document.
5. Clear the cache using the following command (optionally):

```
make clear
```
6. Open a browser to [localhost:8080](http://localhost:8080).

## Behind the scenes
Technology:
* PHP 8.2
* Laravel 10
* signNow API PHP SDK 2.2
* Docker
* Native JavaScript
* HTML
* Bootstrap CSS Framework

The application contains both backend and tiny frontend components. The frontend consists of a web form where you can enter the first and last names of your signer and a comment.

After the form is submitted, the backend uploads the PDF file to signNow using your credentials provided with the `.env` configuration file. The backend also adds the first and last names and comment fields to the document. The backend then creates an embedded invite to sign your document and generates a link for the invite. This type of invite is called 'embedded' because you can integrate it into your website or mobile application.

The frontend receives the invite link and embeds the signNow document editor into a website or app using an `<iframe/>` tag. Using this method, the signing session is built into the website. You can also customize the signing experience by using the [branding feature](https://docs.signnow.com/docs/signnow/branches/v1.2/guides-branding). All backend operations are performed using the signNow PHP SDK.

## More information

| Topic | URL |
|-----------------------|--------------------------------------------|
| signNow website | <https://www.signnow.com/> |
| PHP SDK | <https://github.com/signnow/SignNowPHPSDK> |
| signNow documentation | <https://docs.signnow.com/> |

## License

This repository is under the MIT license. You are free to use the code of this application as a skeleton for your application. For more information, see [LICENSE](./LICENSE).
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
27 changes: 27 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
Loading

0 comments on commit a91422b

Please sign in to comment.