Download the PHP package getodden/mail without Composer

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

Odden Mail Builder (getodden/mail)

Latest version PHP

A modular, Outlook-bulletproof email building, auditing, and compilation engine for Laravel applications.

Build an email from 31 responsive blocks (in code, in a Filament form, or in a drag-and-drop editor), audit it before it goes out, and compile it to inlined HTML, AMP for Email, MJML, or plain text. It is a plain Laravel package: the compiler is PHP, with no Node step at send time.

Try the editor in your browser: it is the one in this package, with nothing saved or sent.

Requires PHP 8.3+ and Laravel 12 or 13. Maintained by CaskStack, LLC.

Status: All 31 slot types are rendered by the compiler, described in the slot schema, and editable in both the Filament builder and the drag-and-drop editor.


Key Features


Installation

Publish configuration and views (optional):

Configuration

config/mail-builder.php sets the default layout theme (width, fonts, colors) and the footer identity used when a slot doesn't provide one:

raw_html_max_bytes (default 100000) is the largest a rich text or raw HTML field may be, and max_document_bytes (default 1500000) is the largest the slots of one email may add up to; see Security.

CAN-SPAM and similar laws require a physical mailing address in marketing email, so set MAIL_BUILDER_ADDRESS or pass address to each footer slot.


Quick Start

1. Building and Compiling an Email


2. Personalization & Merge Tags

Personalization supports dot-notation object paths, Liquid filters, and inline conditionals:

Built-in tags are {{unsubscribe_url}}, {{current_year}}, and {{web_view_url}}. Register your application's own tags so they appear in the Filament builder's tag picker and in previews:

Available Filters:

Escaping. TemplateMailable (the transactional send) HTML-escapes every value that comes from the data you pass in, where it lands in the message's HTML: a name or a note a customer typed cannot add markup or a link to your email. Text you wrote in the template, including a default fallback, is left as written. If a value really is markup you trust (an order table you built), say so in the template: {{ order_table | raw }}. The plain-text part and the subject are text and are not escaped; the subject is always one line, and unsubscribe_url / listUnsubscribeUrl must be an http(s) or mailto address to become a List-Unsubscribe header.

The raw filter is honored only for a template string you wrote. TemplateMailable accepts it when you pass an HTML string, and ignores it (the value is escaped) when you pass a document or slot arrays, because a tenant user authored those. The same goes for compileDocument() with interpolate: true, which always escapes and never honors raw. MailBuilder::interpolate() and MergeTagInterpolator::interpolate() ignore raw unless you pass allowRaw: true; never do that for HTML a tenant user authored.

MailBuilder::interpolate($content, $context) does not escape (callers that escape their own values rely on that); pass escape: true to escape.

Conditionals ({% if %}) work in text and in body_text, one block at a time: blocks must be balanced and cannot be nested, or the email is rejected. They are not supported in the raw html slot; see Security. To show content to part of the audience, prefer the slot's visibility rules.


3. Ingestion (HTML & MJML Import)

Import external templates into editable modular slots:


4. Deliverability, Performance & Accessibility Audits


5. Sending Emails via TemplateMailable


6. Filament Visual Builder Integration

Requires filament/forms ^5.0. To integrate the modular slot builder into any Filament Resource:


7. Slot schema (for editors)

Each slot type can describe itself: which fields its data takes, how to label and edit them, and the default of each. The Filament form is generated from this description, and a drag-and-drop editor can read it as JSON, so the two always agree with the slot's view.

A field has a key, a type (text, textarea, rich_text, url, image, color, select, toggle, number, tags, items), a label, required, a default, and, where they apply, placeholder, help, options and the item fields of a list. Fields marked advanced are read by the slot's view but kept out of the basic form: an editor shows them as style options.

All 31 slot types are described, so the editor and the Filament blocks can edit every one of them (see Supported Slot Types). Tests check that every described field is read by its slot's view, so the description cannot drift from what is rendered.

8. Drag-and-drop editor

An editor for the slots, built as a web component with no framework: <odden-mail-editor>. It shows the email as it will be sent, with a palette of blocks, a structure list, and a settings panel for the selected block. Drag a block from the palette onto the email, or drag a block to move it. Every action also has a button and a keyboard shortcut, and changes are announced to screen readers. Undo and redo (Ctrl or Cmd + Z, Shift + Z) cover everything.

The editor edits the slot document as data and never touches HTML. The server renders the preview with the same compiler that builds the email, so what you see is what is sent, and the preview cannot be broken by editing. Every slot type is editable (see the slot schema above). A slot of a type the editor does not know, such as one from a newer version, is kept as it is: you can move, duplicate and delete it, and its preview is rendered.

1. Turn on the routes. The editor needs two routes, a slot schema and a preview. They are off by default, because anyone who can reach them can render email HTML. Switch them on in config/mail-builder.php and set your own middleware:

2. Publish the editor files (plain JavaScript modules and one stylesheet, no build step):

3. Use the element:

The preview is rendered into a sandboxed iframe with scripts disabled, so a slot that holds HTML cannot run code in your admin page.

To try it while developing the package: vendor/bin/testbench serve, then open the home page.

9. The editor as a Filament field

MailEditor puts the drag-and-drop editor in a Filament form. It is a drop-in for EmailSlotBuilder::make('slots'): the state is the same list of slots ({type, data}), so it saves to the same column.

The theme can also be a closure, evaluated for every preview, so the preview follows the form. For example, with the theme's fields in the same form under theme.*:

The field's theme wins over a theme sent by the browser.

Supported Slot Types (31 Total)

Slot Type Key Description
Header & Logo header Branding bar with logo, web-view link, and optional date
Hero Banner hero Headline, badge pill, subtext, and bulletproof CTA button
Text & Content body_text Editorial rich text with merge tags and alignments
CTA Button button Bulletproof Outlook VML action button
2-Column Grid two_column Side-by-side cards with reverse mobile stacking (rtl)
3-Column Grid three_column Three responsive feature cards
4-Column Wall four_column Partner logo trust wall or compact icon links
Asymmetric Split asymmetric_columns 1/3 + 2/3 editorial sidebar split
Feature List features Bulleted list with icons, bold titles, and descriptions
Event Details event Event card with date, time, location, description, and a registration button
Image Gallery gallery Two or three column image grid with captions and links that stacks on mobile (renders at most 12 images)
Testimonial testimonial Quote callout with star rating and author attribution
Stat Box stat_box Key metric numbers and percentage badges
Divider Line divider Horizontal rule or spacer with configurable height
Labeled Divider labeled_divider Horizontal line with centered text badge (e.g. "OR")
Social Links social_links Multi-channel social icon bar
App Badges app_badges Official Apple App Store and Google Play buttons
Data Table data_table Multi-column comparison table with zebra striping
Image Banner image_banner Responsive banner image with alt text and link
Video Card video_card Thumbnail with play button overlay linking to video
Pricing Grid pricing_grid Multi-tier pricing cards with featured plan highlight
Rating Scale rating_bar 1-Click NPS or CSAT survey buttons (1-10 or 1-5 scale)
Countdown Urgency countdown_timer Urgency banner with deadline and offer CTA
Accordion / FAQ accordion Stacked Q&A cards for policies and instructions
Dynamic Feed dynamic_feed Product recommendation grid with live JSON hydration
Order Receipt order_receipt Itemized invoice summary with taxes and subtotals
RSS Article Feed rss_feed Syndicated blog digest with publication dates
Product Catalog product_catalog Ecommerce cards with compare-at pricing and buy CTAs
Coupon Code coupon_code Promo voucher card with dashed border and expiry
Footer & Compliance footer CAN-SPAM / GDPR address, optional required notice or warning, and unsubscribe link
Custom Raw HTML html Bespoke HTML code component

Custom Slot Types

Register your own slot type with the SlotRegistry singleton. A registered slot compiles, exports, validates, previews, appears in SlotSchemaRegistry::toArray(), and gets a block in the Filament EmailSlotBuilder.

Security

Tenant users can author what this package renders, so untrusted input is sanitized in three places. None of it relies on the author's markup being well formed.

  1. Schema layer. Before a view renders, SlotDataSanitizer cleans each slot's data from the slot's schema, for built-in and custom slots alike. The plain-text fallback reads the same sanitized data, so the text never shows a URL or an image the HTML dropped.
  2. Output layer. After merge tags are interpolated and CSS is inlined, HtmlUrlScrubber rewrites every href, xlink:href, src, action, formaction, background, poster and data attribute in the final HTML (quoted or unquoted, inside conditional comments and VML tags too), drops srcset, and drops an animation values list that holds an unsafe URL. The AMP compiler sanitizes its slots' data and raw content the same way and runs the scrubber on its output. Entities are decoded first, so &#106;avascript: is caught. A value that passes is left byte for byte as written. This layer is a safety net behind the allowlist sanitizer, because it is built from patterns. It fails closed: when the regex engine gives up, scrub() throws Odden\MailBuilder\Exceptions\UnscrubbableHtmlException and never returns the page unscrubbed.
  3. Send layer. A tag such as {{ link }} or {{ x | default(javascript:alert(1)) }} only resolves when TemplateMailable interpolates, after the compiler's scrub. TemplateMailable therefore runs HtmlUrlScrubber again on the interpolated HTML, for slot templates and for HTML string templates alike.

The rules:

What the raw sanitizer drops from pasted marketing HTML, so you know before you paste a template from another tool:

A large pasted template is better built from slots, which carry their own Outlook-safe markup and are not limited by the cap. Use MailBuilder::importHtml() to turn HTML into slots.

The supported symfony/html-sanitizer range is ^7.2 || ^8.0. On PHP 8.3 the sanitizer uses the Masterminds HTML5 parser instead of PHP 8.4's native one. The test suite runs on one PHP version, so the Masterminds path is untested here.

What stays with the host app:

Upgrading from 2.x

Version 3.0.0 changes what the compiler keeps from raw HTML and rich text, tightens merge tag rules, and adds a required symfony/html-sanitizer dependency. Read the upgrade checklist in CHANGELOG.md before you update.

Testing


Feed blocks

The rss and dynamic_feed blocks fetch JSON from the feed_url stored in the email, when the email is compiled. Because that URL is content, the fetch is guarded: the host must resolve only to public addresses (private, loopback, link-local and cloud metadata addresses are refused), redirects are not followed, the request times out after a few seconds, and a response over mail-builder.feeds.max_bytes (1 MB) is ignored. A refused or failed feed falls back to the block's own items. To fetch a feed you serve from your own network, list its host in mail-builder.feeds.allowed_hosts.


Sending, lists and campaigns

This package builds and checks emails. It does not manage contacts, lists, consent or sending. Those come from Odden CRM (open source) and its paid add-ons, or from your own application: TemplateMailable sends through any Laravel mailer. See odden.io for Odden Cloud and the paid Marketing add-on.


License

The MIT License (MIT). See LICENSE.md.


All versions of mail with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-dom Version *
ext-libxml Version *
guzzlehttp/guzzle Version ^7.8.2 || ^8.0
laravel/framework Version ^12.0 || ^13.0
symfony/html-sanitizer Version ^7.2 || ^8.0
tijsverkoyen/css-to-inline-styles Version ^2.2.5
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 getodden/mail contains the following files

Loading the files please wait ...