DeveloperX
DeveloperX

Reputation: 661

How to call a PDFtk command within Laravel in AWS lambda

my laravel app is running on aws lambda, so I don't have access to console to perform some tasks, for example interact with pdfs, I was trying to use aws lambda layers, I have this package: https://github.com/inetsys/pdftk-aws-lambda I Already upload the zip file, also installed the sidecar package: hammerstone/sidecar Then I wrote this class:

<?php

namespace App\Sidecar;

use Hammerstone\Sidecar\Package;
use Hammerstone\Sidecar\LambdaFunction;
use Hammerstone\Sidecar\Runtime;

class Pdftk extends LambdaFunction
{
    public function handler()
    {
        return '';
    }

    public function package()
    {
        ///return 
    }


    public function runtime()
    {
        ////return
    }

    public function layers()
    {
        return [
            'arn:aws:lambda:us-west-2:xxxxxxxxxxxx:layer:PDFtk:1'
        ];
    }
}

I know the pdftk library works like this using shell commands in php:

$command = "pdftk $inputFile input_pw $password output $outputFile";
 $result = shell_exec($command);

But I don't know what would be the content of handler() package() and runtime() methods. What can I do?

Upvotes: 1

Views: 86

Answers (0)

Related Questions