elliotjreed / disposable-emails-filter-php

A PHP package for determining whether an email address is from a disposable / temporary email address provider.
https://packagist.org/packages/elliotjreed/disposable-emails-filter
MIT License
27 stars 8 forks source link

Modify function and property scopes #8

Open omarcinkonis opened 4 months ago

omarcinkonis commented 4 months ago

Hello, from my research, it seems that this package has the most comprehensive blacklist out of all options. I would really like to use it, but I ran into a couple of problems

  1. I need to access the list of domains as array; getDomainsFromFile method is private and I cannot use it
  2. I would like to extend the Email class, but I cannot use private string $emailListPath; in my own methods

Suggestions:

  1. Update all private to protected so that the class can be extended
  2. (optional) Make getDomainsFromFile public
kaystrobach commented 6 days ago

The domains are listed here:

You may read it from the line by line with file function and do your magick there.

The scope of the package is very clear and i understand @elliotjreed for his restrictions.

elliotjreed commented 6 days ago

Hello! Apologies I completely missed your original issue @omarcinkonis.

I've pushed a new version / tag (5.0.0) with an additional methods:

<?php

require 'vendor/autoload.php';

use ElliotJReed\DisposableEmail\Email;

foreach ((new Email())->getDomainList() as $domain) {
    echo $domain . PHP_EOL;
}

or

<?php

require 'vendor/autoload.php';

use ElliotJReed\DisposableEmail\DisposableEmail;

foreach (DisposableEmail::getDomainList() as $domain) {
    echo $domain . PHP_EOL;
}

Thank you for replying @kaystrobach!