Download the PHP package svss-labs/email-verification-api without Composer

On this page you can find all versions of the php package svss-labs/email-verification-api. 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-verification-api

📧 ✅ Email Verification API for PHP

A PHP library to verify Email Verification Tokens (EVT) issued through the Email Verification Protocol — the proposed web standard that lets browsers verify a user's email address with their email provider directly, without one-time passwords (OTPs) or magic links.

The user picks their email address in a form, the browser obtains a cryptographically signed token from their email provider (e.g. Gmail), and your server verifies it with this package. No email is ever sent.

Requirements

Installation

How the protocol works

  1. Your site renders a form with a hidden field carrying a per-render nonce.
  2. The user enters (or autocomplete-selects) their email address.
  3. The browser discovers the issuer via a DNS TXT record (_email-verification.<email-domain>), confirms the user's session with the provider, and obtains a signed token.
  4. On form submit, the browser attaches the token (an SD-JWT with a Key Binding JWT) to the hidden field.
  5. Your server verifies the full package: parsing → expected values (email/nonce/audience/age) → DNS delegation → issuer signature (metadata + JWKS) → key binding.

Full protocol details: Chrome developer article.

Usage

Form markup

The browser only attaches a token when the form follows this exact contract:

Laravel example

The token is bound to the nonce that was present when the user's email field changed, which can happen on a page load different from the submit. Store a small pool of recent nonces server-side (here in the session) so the submit handler can match the one the token was bound to.

routes/web.php

app/Http/Controllers/EmailVerificationController.php

resources/views/signup.blade.php

Nonce matching: pull('evp_nonce') works when the submit happens on the same page load. For the field-change-on-early-load case, keep the pool from show() (e.g. in the session) and match the nonce claim embedded in the token's KB-JWT, exactly like example/live-demo.php does.

VerifyEmailTokenInput

Parameter Type Default Description
token string — Full EVT+KB presentation as submitted by the browser
nonce string — The nonce your site generated for this form render
email string — The email address being verified (compared case-insensitively)
audience string — Your HTTP(S) origin, e.g. https://your-domain.com
maxTokenAgeSeconds int 300 Maximum accepted token age
clockToleranceSeconds int 60 Allowed clock skew
fetch ?callable null Override HTTP fetching (tests). null = real HTTPS via Guzzle
resolveTxt ?callable null Override DNS TXT resolution (tests). null = real dns_get_record
resolveHost ?callable null Override A/AAAA resolution (tests). null = real DNS
now ?callable null Clock override returning Unix milliseconds (tests)

Result

verifyEmailToken() returns a Result object:

Common error codes:

Code Meaning
TOKEN_MALFORMED Token is not a parseable EVT+KB presentation
EMAIL_MISMATCH / NONCE_MISMATCH / AUDIENCE_MISMATCH Expected values don't match token claims
TOKEN_EXPIRED / TOKEN_NOT_YET_VALID iat outside the accepted window
DNS_DELEGATION_MISSING / DNS_DELEGATION_AMBIGUOUS No (or multiple) iss= TXT records at _email-verification.<domain>
ISSUER_MISMATCH DNS-delegated issuer differs from the token issuer
METADATA_FETCH_FAILED / JWKS_FETCH_FAILED Issuer endpoints unreachable
ALGORITHM_UNSUPPORTED EVT signed with an algorithm the issuer doesn't advertise
EVT_SIGNATURE_INVALID Signature doesn't verify against the issuer's JWKS
KB_SIGNATURE_INVALID Key Binding JWT doesn't verify against the cnf.jwk ephemeral key
SD_HASH_MISMATCH sd_hash doesn't match the presented token

Security notes

Testing your integration

1. Offline demo (no browser needed)

Uses test fixtures and mocked network callbacks to walk through a successful verification.

2. Live browser demo (real Google/Gmail verification)

Open http://localhost:8080, enter your Gmail address, and submit — the page verifies a real token against Google's production issuer (real DNS, real JWKS).

⚠️ Browser requirements — enable the Chrome flag

The browser side of this protocol is experimental and disabled by default. If no token is attached to your form:

  1. Open chrome://flags/#email-verification-protocol and set Email Verification Protocol to Enabled

Also required:

You can sanity-check your browser setup independently with Google's verifier demo and mock email provider.

Troubleshooting

Symptom Fix
No token in the POST at all Enable the chrome://flags entry above; check you're signed in to the provider
NONCE_MISMATCH The token is bound to the nonce present when the email was entered. Keep one nonce per form render and store issued nonces server-side (the live demo keeps a small pool) until submit
METADATA_INVALID Older releases required the JWKS host to equal the issuer host — Gmail hosts its JWKS on a separate domain; update to a fixed version
DNS_DELEGATION_MISSING The email domain has no _email-verification TXT record — only participating providers (e.g. Gmail) can issue tokens
Verification works on rowan.fyi but not your origin Origin trial token missing/expired for your origin

Development

Compatibility

License

The MIT License (MIT). Please see License File for more information.


All versions of email-verification-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3 || ^8.4 || ^8.5
ext-curl Version *
ext-gmp Version *
ext-openssl Version *
ext-sodium Version *
guzzlehttp/guzzle Version ^7.0 || ^8.0
k2gl/sd-jwt Version ^1.0
web-token/jwt-framework Version ^4.1
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 svss-labs/email-verification-api contains the following files

Loading the files please wait ...