Download the PHP package schantldev/statamic-formattach without Composer

On this page you can find all versions of the php package schantldev/statamic-formattach. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-formattach

Statamic FormAttach

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

Features

This addon provides:

How to Install

Install the addon using composer.

Publish the configuration file.

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

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.

Attaching PDFs

There is a default attachment that will generate a PDF using Spatie's Browsershot package[^1]. 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.

[!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

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].

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 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 context)

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.

[^1]: The addon required 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. [^2]: Refer to the offical Laravel documentation on how to create attachments in various ways.


All versions of statamic-formattach with dependencies

PHP Build Version
Package Version
Requires statamic/cms Version ^5.0
laravel/pint Version ^1.18
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package schantldev/statamic-formattach contains the following files

Loading the files please wait ....