PHPackages                             schantldev/statamic-formattach - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. schantldev/statamic-formattach

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

schantldev/statamic-formattach
==============================

v1.2.0(11mo ago)1427↓60%PHP

Since Jul 18Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/schantldev/statamic-formattach)[ Packagist](https://packagist.org/packages/schantldev/statamic-formattach)[ RSS](/packages/schantldev-statamic-formattach/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (4)Versions (8)Used By (0)

Statamic FormAttach
===================

[](#statamic-formattach)

> Statamic FormAttach is a Statamic addon that allows to easily attach any files to form submission mails dynamically.

Features
--------

[](#features)

This addon provides:

- A standard PDF attachment for form submissions[1](#user-content-fn-1-a5fdba25719e6419f129f450c78dc59b)
- Support for any other attachment(s) you might need to add dynamically

How to Install
--------------

[](#how-to-install)

Install the addon using composer.

```
composer require schantldev/statamic-formattach
```

Publish the configuration file.

```
php artisan vendor:publish --tag=statamic-formattach-config
```

Swap out the send email job in your `statamic/forms.php` config file.

```
/*
|--------------------------------------------------------------------------
| Send Email Job
|--------------------------------------------------------------------------
|
| The class name of the job that will be used to send an email.
|
*/

'send_email_job' => \SchantlDev\Statamic\FormAttach\Forms\SendEmailWithAttachments::class,
```

How to Use
----------

[](#how-to-use)

After publishing the config file, you will be able to add attachments to any forms you wish. There's an array with the form handle and attachments to possibly be added.

```
'forms' => [
    'form_handle' => [
        // \SchantlDev\Statamic\FormAttach\Attachments\AttachPdf::class,
    ],
],
```

### Attaching PDFs

[](#attaching-pdfs)

There is a default attachment that will generate a PDF using Spatie's Browsershot package[1](#user-content-fn-1-a5fdba25719e6419f129f450c78dc59b). In the config, you can find more settings for choosing a paper size and setting a custom logo. If that's not enough, you can opt in to publish the view\[^3\] and adjust it to your needs or create your own custom attachment.

```
php artisan vendor:publish --tag=statamic-formattach-views
```

Tip

If you wanna see a live preview while working on the view, there's a way! There are two routes you can use for your already saved submission:

1. as HTML: submissions/{submission\_id}/preview
2. as PDF: submissions/{submission\_id}/preview\_pdf

### Custom attachments

[](#custom-attachments)

Sometimes, PDFs are just not enough or you need some more fine-grained control over the attachment. In that case, you can extend the `FormAttachment` class and implement its abstract method to provide any attachment in form of a mailable attachment[2](#user-content-fn-2-a5fdba25719e6419f129f450c78dc59b).

```
use Illuminate\Mail\Mailables\Attachment;

abstract class FormAttachment {
    ...
    public function check(): bool;
    abstract public function attachment(): ?Attachment;
}
```

### Controlling whether to add an attachment

[](#controlling-whether-to-add-an-attachment)

In the above excerpt, you can see a `check()` method that is present within a FormAttachment class. Use it to decide on whether to add an attachment or not. You can use the [SubmissionHelper](src/Forms/SubmissionHelper.php) object that gives you access to the submission data, the form, the blueprint of the form and the config of the mail.

**Example: (only attach PDF to owner mail - in a [Statamic Peak](https://github.com/studio1902/statamic-peak) context)**

```
namespace App\FormAttachments;

use SchantlDev\Statamic\FormAttach\Attachments\AttachPdf;

class PdfAttachment extends AttachPdf
{
    public function check(): bool
    {
        return $this->submissionHelper->config['html'] == 'email/form_owner';
    }
}
```

Contributing and Issues
-----------------------

[](#contributing-and-issues)

Contributions and discussions are always welcome, no matter how large or small. If you happen to find an issue, please open up a Github issue or do a PR if you can.

Footnotes
---------

1. The addon requires Browserhot for the PDF attachment to work out of the box. Please note that the addon will not install Browsershot for you as you might have already installed some version of it. Please install Browsershot directly into your project. [↩](#user-content-fnref-1-a5fdba25719e6419f129f450c78dc59b) [↩2](#user-content-fnref-1-2-a5fdba25719e6419f129f450c78dc59b)
2. Refer to the offical [Laravel documentation](https://laravel.com/docs/mail#attachments) on how to create attachments in various ways. [↩](#user-content-fnref-2-a5fdba25719e6419f129f450c78dc59b)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance54

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% of commits — single point of failure

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 ~124 days

Total

4

Last Release

333d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/066c73af212709bf82a46e2dfe00e73a6514c11a6d1858acc68a31d70a5ee2ca?d=identicon)[AndreasSchantl](/maintainers/AndreasSchantl)

---

Top Contributors

[![andjsch](https://avatars.githubusercontent.com/u/9936988?v=4)](https://github.com/andjsch "andjsch (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/schantldev-statamic-formattach/health.svg)

```
[![Health](https://phpackages.com/badges/schantldev-statamic-formattach/health.svg)](https://phpackages.com/packages/schantldev-statamic-formattach)
```

###  Alternatives

[statamic/seo-pro

68488.6k](/packages/statamic-seo-pro)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135212.4k7](/packages/statamic-rad-pack-runway)[erag/laravel-pwa

A simple and easy-to-use PWA (Progressive Web App) package for Laravel applications.

179110.0k](/packages/erag-laravel-pwa)[rias/statamic-redirect

29322.9k](/packages/rias-statamic-redirect)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

23100.9k12](/packages/marcorieser-statamic-livewire)[withcandour/aardvark-seo

Save time and get your Statamic site to rank better with the SEO addon for Statamic.

15131.5k](/packages/withcandour-aardvark-seo)

PHPackages © 2026

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