prosales/laravel-vdp-studio

This Laravel package is meant for internal purposes of the Pro Sales AG only - no external support.

v0.5.1 2020-03-31 18:08 UTC

README

THIS PACKAGE IS MEANT FOR INTERNAL USAGE WITHIN THE PRO SALES AG! NO SUPPORT FOR OTHERS - WE ARE SORRY!

Introduction

PS-Laravel Customer Canvas VDP is a simple wrapper to use the customer canvas web API in your Laravel application. It allows you to use customer canvas in combination with the VDP Add-On.

Requirements

Composer

https://getcomposer.org

This package utilizes Composer to manage its PHP dependencies. So, before using PS-Laravel Customer Canvas VDP, make sure you have installed the latest version of Composer on your machine:

composer --version

Please use the composer self-update command frequently, in order to update Composer to its latest version.

Customer Canvas

https://customerscanvas.com/editor/buy

Professional Server

Please choose the professional server (v5.0) and run the installation. In our case we use the on-premises solution but you are also free to use the cloud version. Please checkout the following page in order to receive further information: https://customerscanvas.com/docs/cc/evaluating-product-on-development-computer.htm.

Variable Data Printing (VDP) add-on

This package is meant to use the VDP add-on, hence you must ensure that you have enabled the VDP add-on (v5.0) on your customer canvas server.

PHP

https://www.php.net/

The PS-Laravel Customer Canvas VDP is a PHP package, hence you must ensure that you have installed PHP equal or above version 7.0.0 (≥7.0.0).

php --version

Listed below you will find the required PHP extensions. Please use the php -m command to check if the following PHP extensions are enabled:

BCMath PHP Extension
CType PHP Extension
JSON PHP Extension
MBString PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

Getting Started

Step-01: Use Composer

Use Composer in order to install the package:

composer require prosales/laravel-vdp-studio

Step-02: Set Environment Variables

Set the following configuration within your DotEnv file (.env):

VDP_SERVER=https://example.com
VDP_WEB_API_KEY=secret-key

Please don't forget to change the values with your own credentials.

Code Examples

Fetch Collection with available Design Files

VdpStudio::getDesigns();

Returns a Laravel collection that list all available design files.

Change User

By default we are using the default user you can change this using:

VdpStudio::setUser('userId');

Weird Usage Example

$design = VdpStudio::getDesign('samples/name-photo');

$design->setText('Last.Name', 'Mickey');

$design->setTexts([
   'First Name' => 'Mickey',
   'test' => [
       'me' => 'TEST ME'
   ]
]);

$design->setImages([
    'photo' => 'https://upload.wikimedia.org/wikipedia/commons/4/4e/Docker_%28container_engine%29_logo.svg',
    'PHOTO' => [
        '2' => 'https://i.ytimg.com/vi/bseyU2PvBQo/maxresdefault.jpg'
    ]
]);

return $design->store(storage_path('pdfs/user/1/test.pdf'));

Supported Versions

PACKAGE VERSION LARAVEL VERSION PHP VERSION SUPPORT
1.0 5.5 7.0.0 Pro Sales AG only!

License

This open source package is available under the MIT license.

© Copyright 2020, Pro Sales AG (prosales@pro-sales.ch) - All rights reserved.