Download the PHP package omegavesko/email-parser without Composer
On this page you can find all versions of the php package omegavesko/email-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download omegavesko/email-parser
More information about omegavesko/email-parser
Files in omegavesko/email-parser
Package email-parser
Short Description A library that makes it easy to get various information about a given email address.
License MIT
Informations about the package email-parser
email-parser
email-parser
is a PHP library that makes it easy to get various information
about an email address.
Features
- ✔️ Configurable email validation (powered by egulias/email-validator)
- 🔍 Separate an email address into its segments
- 🌎 Get information about the email provider, based on the domain
Getting Started
Prerequisites
- PHP >= 7.4
- Composer
Installing
Usage
To use the parser, create an instance of the EmailParser
class, and use the
parseEmail()
and parseEmails()
methods to parse emails into EmailInformation
instances.
Getting email provider information
If an email uses the domain of a recognized popular public email provider
(e.g. Gmail), email-parser
will give you its name, the domains it knows about,
and a URL to the service's webmail interface.
One particularly useful application of this feature is linking a user directly to their email inbox, if, for example, you want to make it as easy as possible for them to get to an email you've just sent them.
If the email isn't from a public email provider, or one email-parser
doesn't
recognize, getEmailService()
will return null
.
Configuration
While email-parser
works perfectly fine out of the box with zero configuration,
there's a few things you can configure to better integrate it into your codebase,
or to adapt it to your needs.
The EmailParser
constructor takes the following optional arguments:
$logger
: An instance ofPsr\Log\LoggerInterface
.email-parser
will use this to log things like non-fatal warnings.-
$emailValidation
: An instance ofEgulias\EmailValidator\Validation\EmailValidation
.email-parser
will use this validation to validate all emails it parses. See the EmailValidator docs for available validations.If left blank, a simple
RFCValidation
will be used as a sane default.
Development
Running the tests
Authors
- Veselin Romić ([email protected])
License
This project is licensed under the MIT License - see the LICENSE file for details.
All versions of email-parser with dependencies
ext-json Version *
symfony/serializer Version ^4.3
symfony/property-access Version ^4.3
psr/log Version ^1.1
egulias/email-validator Version ^2.1