PHP composer library / SDK for merging or Concatenate multiples PDf(.pdf) files.
Install libmerge pdf sdk by Packagist composer.
Open your folder with CMD for installation of the composer package and run below command.
Installation
composer require iio/libmergepdf
Library for merging multiple PDFs
https://packagist.org/packages/iio/libmergepdf
Add bulk .pdf files using PHP array.
<?php require 'vendor/autoload.php'; use iio\libmergepdf\Merger; use iio\libmergepdf\Pages; $merger = new Merger; $merger->addIterator(['pdf/A.pdf', 'pdf/B.pdf']); $createdPdf = $merger->merge(); $myfile = fopen("newfile.pdf", "w") or die("Unable to open file!"); $txt = $createdPdf; fwrite($myfile, $txt); fclose($myfile); ?>
Check your new merge pdf file in the root directory.
if need to upload multiple files easily, can browser below blog help to achieve the best solution for uploading multiple pdf files.
Upload multiple files with Ajax and Move to upload by PHP with create different folder