PHPackages                             asamoahboateng/academic-email-verifier - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. asamoahboateng/academic-email-verifier

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

asamoahboateng/academic-email-verifier
======================================

A PHP package to verify if an email address belongs to an academic or research institution. Live demo: https://verify-academic-email.asamoahboateng.com

1.0.0(11mo ago)081MITPHPPHP ^8.2

Since May 20Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/asamoahboateng/Academic-Email-Verification)[ Packagist](https://packagist.org/packages/asamoahboateng/academic-email-verifier)[ RSS](/packages/asamoahboateng-academic-email-verifier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Academic Email Verifier
=======================

[](#academic-email-verifier)

[![Version](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)](https://packagist.org/packages/asamoahboateng/academic-email-verifier)

A PHP package to verify if an email address belongs to an academic or research institution. This package helps you validate whether an email address is from a recognized academic institution.

Live Demo
---------

[](#live-demo)

Try the package live at: [verify-academic-email.asamoahboateng.com](https://verify-academic-email.asamoahboateng.com)

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require asamoahboateng/academic-email-verifier:^1.0
```

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- JSON extension

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use AcademicEmailVerifier\AcademicEmailVerifier;

$verifier = new AcademicEmailVerifier();

// Verify an academic email
$result = $verifier->verify('student@harvard.edu');

// Check the result
if ($result['is_academic']) {
    echo "This is an academic email from: " . $result['university'];
} else {
    echo "Error: " . $result['error'];
}
```

### Domain Exceptions

[](#domain-exceptions)

You can add custom domain exceptions for institutions that aren't in the main database:

```
use AcademicEmailVerifier\AcademicEmailVerifier;

$verifier = new AcademicEmailVerifier();

// Add multiple domain exceptions
$verifier->addDomainException('custom.edu', 'Custom University');
$verifier->addDomainException('research.org', 'Research Institute');
$verifier->addDomainException('college.ac.uk', 'British College');

// You can add as many as you need
$verifier->addDomainException('university.edu.gh', 'Ghana University');
$verifier->addDomainException('institute.co.za', 'South African Institute');

// Get all domain exceptions
$exceptions = $verifier->getDomainExceptions();
// Result will contain all added exceptions:
// [
//     'custom.edu' => ['name' => 'Custom University', 'domains' => ['custom.edu']],
//     'research.org' => ['name' => 'Research Institute', 'domains' => ['research.org']],
//     'college.ac.uk' => ['name' => 'British College', 'domains' => ['college.ac.uk']],
//     'university.edu.gh' => ['name' => 'Ghana University', 'domains' => ['university.edu.gh']],
//     'institute.co.za' => ['name' => 'South African Institute', 'domains' => ['institute.co.za']]
// ]

// Remove specific exceptions
$verifier->removeDomainException('research.org');

// Clear all exceptions if needed
$verifier->clearDomainExceptions();
```

### Available Methods

[](#available-methods)

#### verify(string $email): array

[](#verifystring-email-array)

Verifies if an email belongs to an academic institution. Returns an array with:

- `is_academic` (boolean): Whether the email is from an academic institution
- `university` (string|null): The name of the university if found
- `error` (string|null): Error message if verification fails

#### isValidEmail(string $email): bool

[](#isvalidemailstring-email-bool)

Checks if the email format is valid.

#### addDomainException(string $domain, string $institutionName): void

[](#adddomainexceptionstring-domain-string-institutionname-void)

Adds a custom domain to be considered as academic.

#### removeDomainException(string $domain): void

[](#removedomainexceptionstring-domain-void)

Removes a previously added domain exception.

#### getDomainExceptions(): array

[](#getdomainexceptions-array)

Returns all currently added domain exceptions.

#### clearDomainExceptions(): void

[](#cleardomainexceptions-void)

Removes all domain exceptions.

### Example Results

[](#example-results)

```
// Academic email
$result = $verifier->verify('student@harvard.edu');
// Result:
// [
//     'is_academic' => true,
//     'university' => 'Harvard University',
//     'error' => null
// ]

// Non-academic email
$result = $verifier->verify('user@gmail.com');
// Result:
// [
//     'is_academic' => false,
//     'university' => null,
//     'error' => 'Domain not found in academic institutions database'
// ]

// Invalid email format
$result = $verifier->verify('invalid-email');
// Result:
// [
//     'is_academic' => false,
//     'university' => null,
//     'error' => 'Invalid email format'
// ]
```

Testing
-------

[](#testing)

Run the test suite using PHPUnit:

```
composer test
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Author
------

[](#author)

- Kwame Boateng
- Email:

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance50

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

357d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2935dd84a499459962371056a3af48ab3ff8ef2dcfcca646162ee84ed96e395?d=identicon)[asamoahboateng](/maintainers/asamoahboateng)

---

Top Contributors

[![asamoahboateng](https://avatars.githubusercontent.com/u/7695191?v=4)](https://github.com/asamoahboateng "asamoahboateng (6 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/asamoahboateng-academic-email-verifier/health.svg)

```
[![Health](https://phpackages.com/badges/asamoahboateng-academic-email-verifier/health.svg)](https://phpackages.com/packages/asamoahboateng-academic-email-verifier)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
