Download the PHP package lettr/lettr-laravel without Composer

On this page you can find all versions of the php package lettr/lettr-laravel. 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 lettr-laravel

Lettr for Laravel

CI Latest Version on Packagist Total Downloads PHP Version

Official Laravel integration for the Lettr email API.

Requirements

Installation

Publish the configuration file:

Getting Started

The easiest way to set up Lettr in your Laravel application is using the interactive init command:

This command will guide you through:

Tip: If you already have a verified sending domain in your Lettr account, the init command will automatically configure your MAIL_FROM_ADDRESS to match it.

After running lettr:init, you're ready to send emails:

Manual Setup

If you prefer to configure manually, add your Lettr API key to your .env file:

Sending Domain

To send emails through Lettr, you must have a verified sending domain in your Lettr account. Your MAIL_FROM_ADDRESS (or any "from" address you use) must match a verified domain.

For example, if you've verified example.com in Lettr:

Emails sent from addresses on unverified domains will be rejected.

Quick Start

Using Laravel Mail (Recommended)

Add the Lettr mailer to your config/mail.php:

Set as default in .env:

Send emails using Laravel's Mail facade:

Using the Lettr Facade Directly

Laravel Mail Integration

With Mailable Classes

With Raw Content

With Views

Multiple Mail Drivers

Use Lettr for specific emails while keeping another default:

Using Lettr Templates with Mailables

Instead of using Blade views, you can send emails using Lettr templates directly. Extend the LettrMailable class:

Then send it like any other Mailable:

LettrMailable Methods

Method Description
template($slug, $version) Set template slug with optional version
templateVersion($version) Set template version separately
substitutionData($data) Set substitution variables for the template
customHeaders($headers) Set custom email headers
scheduledAt($when) Schedule delivery for a future DateTimeInterface (or ISO-8601 string)

Example: Order Confirmation

Inline Template Sending

For quick template sending without creating a Mailable class, use the Mail::lettr() method:

Note: When no subject is provided, the template's own subject is used. Pass a subject only if you want to override it.

Custom From Address

By default, emails are sent from the address configured in MAIL_FROM_ADDRESS. To send from a different address (e.g. a marketing domain), use from():

For Mailable classes, you can also set the from address in the envelope() method:

Note: The from address must belong to a verified sending domain in your Lettr account.

Custom Headers

You can pass custom headers with your emails. These are forwarded directly to the Lettr API.

For Mailable classes, use the customHeaders() method:

Error Handling

Configuration

The published config/lettr.php file contains:

The templates block configures where lettr:pull, lettr:generate-dtos, and lettr:generate-enum commands save generated files.

The package also supports config('services.lettr.key') as a fallback for the API key.

Documentation

Full guides, every facade method, and complete request/response details live in the docs:

📚 docs.lettr.com/quickstart/laravel

Topic Guide
Install, config, and verify Installation
Mail facade, Lettr facade, Mailables, scheduling, testing Sending Emails
Lettr templates, versioning, pull/push Templates
Generated enums, DTOs, and Mailables Type Safety
Add, verify, and manage sending domains Domains
Webhook endpoints for delivery & engagement events Webhooks
Lists, contacts, topics, properties, segments Audience
List, send, and schedule campaigns Campaigns
Endpoint reference (params & schemas) API Reference

CLI Commands

lettr:check

Verify that your Lettr integration is correctly configured:

Checks mailer registration, API key validity, and sending domain verification. Returns exit code 0 if all checks pass.

lettr:pull

Download email templates from your Lettr account as Blade files:

Option Description
--template= Pull only a specific template by slug
--as-html Save as raw HTML instead of Blade
--with-mailables Also generate Mailable and DTO classes
--skip-templates Skip downloading templates, only generate DTOs and Mailables
--dry-run Preview what would be downloaded

lettr:generate-enum

Generate a PHP enum from your Lettr template slugs for type-safe template references:

Generates an enum like:

lettr:generate-dtos

Generate type-safe DTO classes from template merge tags:

Generated DTOs implement Arrayable and can be passed directly to sendTemplate():

Development

Install Dependencies

Code Style

Static Analysis

Testing

Contributing

Please see CONTRIBUTING for details.

License

MIT License. See LICENSE for details.


All versions of lettr-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
lettr/lettr-php Version ^2.4.0
symfony/mailer Version ^6.2|^7.0|^8.0
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 lettr/lettr-laravel contains the following files

Loading the files please wait ...