PHPackages                             escolalms/templates-pdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. escolalms/templates-pdf

ActivePackage

escolalms/templates-pdf
=======================

Escola Headless LMS Templates for pdf

0.1.24(2y ago)310.1k↓50%1MITPHPPHP &gt;=7.4CI passing

Since Dec 31Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/EscolaLMS/Templates-PDF)[ Packagist](https://packagist.org/packages/escolalms/templates-pdf)[ RSS](/packages/escolalms-templates-pdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (39)Used By (1)

Templates-PDF
=============

[](#templates-pdf)

Package for generating PDFs from configurable Templates.

[![swagger](https://camo.githubusercontent.com/bf46f50926ef796b1bb0b6e41af746af52ff3aacdffb0533450f3b614a7334a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d737761676765722d677265656e)](https://escolalms.github.io/Templates-PDF/)[![codecov](https://camo.githubusercontent.com/e17e5c13b5887366e0165dcf214ef11725cd602e52b24dc92b4dd4f1057a9150/68747470733a2f2f636f6465636f762e696f2f67682f4573636f6c614c4d532f54656d706c617465732d5044462f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4f393146484e4b493652)](https://codecov.io/gh/EscolaLMS/Templates-PDF)[![Tests PHPUnit in environments](https://github.com/EscolaLMS/Templates-PDF/actions/workflows/test.yml/badge.svg)](https://github.com/EscolaLMS/Templates-PDF/actions/workflows/test.yml)[![Maintainability](https://camo.githubusercontent.com/fc3ec41478da199fd2bbd3067099418c1b39ab32432f95862c71da3ca377f39b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36306562383333353164326435353063313563622f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/EscolaLMS/Templates-PDF/maintainability)[![Test Coverage](https://camo.githubusercontent.com/e2ae235e5c26ba7f41d783c991f3a77bacc41724ea6618c84d84603a5fc755e6/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36306562383333353164326435353063313563622f746573745f636f766572616765)](https://codeclimate.com/github/EscolaLMS/Templates-PDF/test_coverage)[![downloads](https://camo.githubusercontent.com/4e1b13a4a0250528ef54b70d442f27777309a86f932e87fb72d221bbc955facb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6573636f6c616c6d732f74656d706c617465732d706466)](https://packagist.org/packages/escolalms/templates-pdf)[![downloads](https://camo.githubusercontent.com/b3b0fbaef16201afe73320fe86d53c72657722ae186bdaf3f22ceba9d224bd84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6573636f6c616c6d732f74656d706c617465732d706466)](https://packagist.org/packages/escolalms/templates-pdf)[![downloads](https://camo.githubusercontent.com/bc1d68c9a0a7d79db432bbbe01ca3c1eec4917cacb5066599933e3c2dc9bef2d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6573636f6c616c6d732f74656d706c617465732d706466)](https://packagist.org/packages/escolalms/templates-pdf)

Purpose
-------

[](#purpose)

This package allows you to create PDFs generated after a specific Event is emitted in Laravel / LMS app.

Each PDF Template has a corresponding class describing available variables that can be used in the Template (which will be stored in database and editable through admin panel). Templates are saved as serialized fabric.js canvas containing these variables which will be replaced during PDF generation with correct data extracted from Event.

Class describing Template Variables must be registered using Template facade from `EscolaLms\Template` package, where you specify which Event it is associated with it and which Channel it is sent through (e.g. `EscolaLms\TemplatesPdf\Core\PdfChannel` which is defined in this package).

Installing
----------

[](#installing)

- `composer require escolalms/templates-pdf`
- `php artisan db:migrate`
- `php artisan db:seed --class="EscolaLms\TemplatesPdf\Database\Seeders\TemplatesPdfSeeder"` to create default templates for all Variable/Event pairs registered for PDF channel

Dependencies
------------

[](#dependencies)

- `EscolaLms\Templates` core Templates package
- optional: `EscolaLms\Courses` for generating PDFs related to Courses

Usage
-----

[](#usage)

### Defining Templates

[](#defining-templates)

1. Create Event which triggers generation of PDF using specified template. This event must implement method `getUser()` returning User model from LMS Core package.
2. Create class defining template Variables, which you will use in PDF template,
3. Associate your class describing template Variables with correct Event and Channel. Use `EscolaLms\Templates\Facades\Template::register(Event class, EscolaLms\TemplatesPdf\Core\PdfChannel::class, Variable class);` method.
4. Use admin panel or `/api/admin/templates` web API to create/edit templates associated with this Variable/Event/Channel set. See [Template package](https://github.com/EscolaLMS/Templates) for more information.

Tests
-----

[](#tests)

Run `./vendor/bin/phpunit --filter 'EscolaLms\\TemplatesPdf\\Tests'` to run tests. See [tests](tests) folder as it contains a basic implementation of Variables class (description of what Template can/must contain) with minimal customisation - a quite good starting point for creating your own.

Test details: [![Maintainability](https://camo.githubusercontent.com/fc3ec41478da199fd2bbd3067099418c1b39ab32432f95862c71da3ca377f39b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36306562383333353164326435353063313563622f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/EscolaLMS/Templates-PDF/maintainability)[![Test Coverage](https://camo.githubusercontent.com/e2ae235e5c26ba7f41d783c991f3a77bacc41724ea6618c84d84603a5fc755e6/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36306562383333353164326435353063313563622f746573745f636f766572616765)](https://codeclimate.com/github/EscolaLMS/Templates-PDF/test_coverage)

Usage on front end
------------------

[](#usage-on-front-end)

### Admin panel

[](#admin-panel)

#### **Left menu**

[](#left-menu)

[![Menu](docs/menu.png "Menu")](docs/menu.png)

#### **List of templates**

[](#list-of-templates)

[![List of templates](docs/list.png "List of templates")](docs/list.png)

#### **Creating/editing template**

[](#creatingediting-template)

[![Creating/editing template](docs/edit.png "Creating or editing template")](docs/edit.png)

Permissions
-----------

[](#permissions)

Permissions are defined in [Enum](src/Enums/PdfPermissionsEnum.php) and seeded in [Seeder](database/seeders/PermissionTableSeeder.php).

Roadmap. Todo. Troubleshooting
------------------------------

[](#roadmap-todo-troubleshooting)

- ???

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance42

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~45 days

Total

34

Last Release

804d ago

PHP version history (2 changes)0.0.1PHP ^7.4|^8.0

0.1.22PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/c857f3115c790c573d0617d7e9ba4011269ef7b9dfdb003dc4388846a62b14f7?d=identicon)[qunabu](/maintainers/qunabu)

---

Top Contributors

[![qunabu](https://avatars.githubusercontent.com/u/214608?v=4)](https://github.com/qunabu "qunabu (16 commits)")[![pa-cholek](https://avatars.githubusercontent.com/u/5345420?v=4)](https://github.com/pa-cholek "pa-cholek (12 commits)")[![daVitekPL](https://avatars.githubusercontent.com/u/58150098?v=4)](https://github.com/daVitekPL "daVitekPL (11 commits)")[![mako321](https://avatars.githubusercontent.com/u/59456825?v=4)](https://github.com/mako321 "mako321 (10 commits)")[![dyfero](https://avatars.githubusercontent.com/u/59400506?v=4)](https://github.com/dyfero "dyfero (5 commits)")[![HerbertIV](https://avatars.githubusercontent.com/u/62691459?v=4)](https://github.com/HerbertIV "HerbertIV (2 commits)")

---

Tags

fabricjslaravel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/escolalms-templates-pdf/health.svg)

```
[![Health](https://phpackages.com/badges/escolalms-templates-pdf/health.svg)](https://phpackages.com/packages/escolalms-templates-pdf)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
