PHP code example of apsg / certificate

1. Go to this page and download the library: Download apsg/certificate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

apsg / certificate example snippets



use Apsg\Certificate\Certificate;
use Apsg\Certificate\Fields\Field;
use Apsg\Certificate\Formats\A4LandscapeFormat;

class CertificateController extends Controller
{
    /**
     * This will output the pdf to browser to download
     */
    public function test()
    {
        $certificate = new Certificate(null, new A4LandscapeFormat());

        return $certificate
            ->setBackground(storage_path('app/public/tlo.png'))
            ->addField(new Field('test zażółć gęślą', 10, 100, 20))
            ->generate();
    }
}