Download the PHP package mmucklo/email-parse without Composer

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

email-parse

Support on Patreon

CI codecov Scrutinizer Code Quality Latest Stable Version Total Downloads PHP Version

Email\Parse is a batch email address parser with configurable RFC compliance levels (RFC 5322, RFC 6531/6532, RFC 2822). Supports internationalized email addresses (UTF-8 local parts and IDN domains).

It parses a list of 1 to n email addresses separated by comma and whitespace by default, with configurable separators (e.g. semicolon).

Other docs: ROADMAP

Installation:

Usage:

Basic Usage

Advanced Usage with ParseOptions

You can configure separator behavior and other parsing options using ParseOptions:

RFC Compliance Presets

The parser provides factory methods on ParseOptions for common RFC compliance levels:

Preset Comparison:

Preset Standard UTF-8 Support Obsolete Syntax Use Case
rfc6531() RFC 6531/6532 Full (NFC normalization) No International apps with UTF-8 emails
rfc5321() RFC 5321 ASCII only No Modern ASCII-only SMTP validation
rfc5322() RFC 5322 + obsolete ASCII only Yes Recommended default (v3.0+)
rfc2822() RFC 2822 ASCII only Yes Legacy system integration
new ParseOptions() Legacy Permissive No v2.x backward-compatible default

RFC 6531 Features (rfc6531()):

Example:

Customizing Rules

Each preset sets a combination of boolean rule properties. Rule properties are readonly (v3.1+) — override them via fluent withX() builders that return new instances:

Available Rule Properties:

Property Default Description
Local-Part Rules
allowUtf8LocalPart true Allow UTF-8 characters in local-part (RFC 6531)
allowObsLocalPart false Allow obsolete syntax: leading/trailing/consecutive dots (RFC 5322 §4.4)
allowQuotedString true Allow quoted-string form in local-part
validateQuotedContent false Validate qtext/quoted-pair rules in quoted strings
rejectEmptyQuotedLocalPart false Reject ""@domain (RFC 5321 EID 5414)
Domain Rules
allowUtf8Domain true Allow Unicode (U-label) domain names (RFC 5890/5891)
allowDomainLiteral true Allow address-literal form [IP] or [IPv6:addr] in domain (RFC 5321 §4.1.3)
requireFqdn false Require at least two domain labels (RFC 5321 §2.3.5)
validateIpGlobalRange true Validate IP addresses are in global range
Character Validation
rejectC0Controls false Reject C0 control characters U+0000-U+001F (RFC 5321)
rejectC1Controls false Reject C1 control characters U+0080-U+009F (RFC 6530)
applyNfcNormalization false Apply NFC Unicode normalization (RFC 6532 §3.1)
validateDisplayNamePhrase false Enforce RFC 5322 §3.2.5 phrase syntax on unquoted display names
strictIdna false Apply full IDNA2008 conformance on U-label domains (RFC 5891/5892/5893)
allowObsRoute false Accept RFC 5322 §4.4 obs-route source-routes like <@host1,@host2:user@host3>
localPartNormalizer null ?callable(string $local, string $domain): string — domain-specific canonicalization hook (v3.3+); set via withLocalPartNormalizer()
Length & Output
enforceLengthLimits true Enforce RFC 5321 length limits (64/254/63)
includeDomainAscii false Include punycode domain_ascii in output

The defaults shown above are for new ParseOptions() (legacy). Each factory method sets its own combination — see the source code for exact values.

ParseOptions Constructor

Configuring Length Limits

You can customize RFC 5321 length limits using the LengthLimits class:

Default RFC Limits:

Supported Separators

Note: When useWhitespaceAsSeparator is false, whitespace is still properly cleaned up and names with spaces (like "John Doe") continue to work correctly.

Internationalized Domains (IDN)

The parser supports internationalized domain names per RFC 5890/5891. Unicode domains are normalized to ASCII (punycode) for validation and length enforcement, while the original Unicode domain is preserved.

The domain_ascii field is included in the output when includeDomainAscii is true on the ParseOptions instance. This is enabled by default in the rfc6531() preset.

Comment Extraction

RFC 5322 allows comments in email addresses using parentheses. The parser automatically extracts these comments and returns them in the comments array:

Comments are stripped from the address field but preserved in original_address.

Migration Guide

Migrating from v2.x to v3.0:

See UPGRADE.md for the complete list of breaking changes, deprecations, and bug-fix behavior changes.

Quick start:

Key differences between legacy and rfc5322():

Adding UTF-8 support:

Function Spec

Other Examples:

The following examples use the legacy array-returning parse() method to document its full output shape. New code should prefer parseSingle() / parseMultiple() (see Basic Usage) for typed return values; both APIs expose the same underlying fields.


All versions of email-parse with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-mbstring Version *
psr/log Version ^3.0
symfony/polyfill-intl-idn Version ^1.31
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 mmucklo/email-parse contains the following files

Loading the files please wait ...