This is a port of the popular Ruby Gem, "Swot". As such, please do NOT make data contributions to this repository. Contribute any new academic domain names to the Ruby version of this package at https://github.com/leereilly/swot. Please follow the contribution guidelines noted on Lee's repository.
I will be pulling changes to upstream domain data.
If you have a product or service and offer academic discounts, there's a good chance there's some manual component to the approval process. Perhaps
.edu
email addresses are automatically approved because, for the most part at least, they're associated with American post-secondary educational institutions. Perhaps.ac.uk
email addresses are automatically approved because they're guaranteed to belong to British universities and colleges. Unfortunately, not every country has an education-specific TLD (Top Level Domain) and plenty of schools use.com
or.net
.
Swot is a community-driven or crowdsourced library for verifying that domain names and email addresses are tied to a legitimate university of college - more specifically, an academic institution providing higher education in tertiary, quaternary or any other kind of post-secondary education in any country in the world.
Install through Composer.
"require": {
"mdwheele/swotphp": "dev-master"
}
The easiest way to get started with SwotPHP is to use a facade to access functionality. However, the base implementation is present as a plain ol' PHP object in case developers want control over the construction themselves. The implementation has an injected dependency on PHP Domain Parser, an implementation of a URL parser backed by the Public Suffix List.
Framework-specific facades / service providers may be added later. The native facade is a good example of how the object should be instantiated.
Native
require_once('vendor/autoload.php');
use SwotPHP\Facades\Native\Swot;
Swot::isAcademic('[email protected]') # true
Swot::isAcademic('[email protected]') # true
Swot::isAcademic('[email protected]') # true
Swot::isAcademic('[email protected]') # true
Swot::isAcademic('[email protected]') # true
Swot::isAcademic('[email protected]') # false
Swot::isAcademic('harvard.edu') # true
Swot::isAcademic('www.harvard.edu') # true
Swot::isAcademic('https://www.harvard.edu') # true
Swot::isAcademic('https://www.github.com') # false
Swot::isAcademic('https://www.rangers.co.uk') # false
Swot::schoolName('[email protected]') -> "University of Strathclyde"
Swot::schoolName('https://www.stanford.edu') -> "Stanford University"
- Lack of automated data import from Ruby gem's domain list.
- There are architectural issues with the package resultant from differences in PHP and Ruby-isms. When I get time, there are two areas I'd like to focus on:
- Consolidate some of how the internal API flows while maintaining public interface.
- Implement a different mode of accessing the public suffix registry. Currently, the package is possibly abusing an excellent URL parser and I'd like to investigate the possibility of a separate component dedicated to modeling the Public Suffix registry's ruleset and algorithms.