Skip to content

Commit d4cc540

Browse files
committed
Initial commit
0 parents  commit d4cc540

20 files changed

+6498
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*.php]
4+
indent_style = space
5+
# indent_size =
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
.phpunit.result.cache
3+
.php_cs.cache

.php_cs.dist

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in('src')
5+
->in('tests')
6+
;
7+
8+
return PhpCsFixer\Config::create()
9+
->setRules([
10+
'@Symfony' => true,
11+
'@PSR2' => true,
12+
// 'strict_param' => true,
13+
'array_syntax' => ['syntax' => 'short'],
14+
])
15+
->setFinder($finder)
16+
;

README.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Mailcheck for PHP
2+
3+
Validate and suggest emails for your email inputs
4+
5+
## Disclaimer
6+
7+
This library uses by default a public data source to suggest various know email
8+
providers.
9+
10+
As this list is pretty much a work in progress you may be missing some domains,
11+
so please feel free to open an issue or a pull request to improve it.
12+
13+
## Installation
14+
15+
`composer require devnix/mailcheck`
16+
17+
## Usage
18+
19+
You just need to initialize an instance to get a shiny suggestion service!
20+
21+
```php
22+
use Devnix\Mailcheck\Mailcheck;
23+
24+
$mailcheck = new Mailcheck();
25+
```
26+
27+
Then you can ask for an array of suggestions, ordered by Levenshtein distance...
28+
29+
```php
30+
$mailcheck->suggest('[email protected]');
31+
```
32+
33+
```
34+
array:5 [
35+
36+
37+
38+
39+
40+
]
41+
```
42+
43+
...or just the first coincidence
44+
45+
```php
46+
$mailcheck->suggestOne('[email protected]');
47+
```
48+
49+
```
50+
51+
```
52+
53+
## Contributing
54+
55+
You can help by reporting bugs, submitting pull requests, providing feedback
56+
about your needs or bad suggestions.
57+
58+
You can execute all the tests by rugging `composer test`. We use tools like
59+
[PHPStan](https://github.com/phpstan/phpstan),
60+
[PHPUnit](https://github.com/sebastianbergmann/phpunit), and
61+
[PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). We like to follow
62+
the [Symfony Coding Standars](https://symfony.com/doc/current/contributing/code/standards.html).

composer.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "devnix/mailcheck",
3+
"description": "Provide email suggestions based on multiple dictionaries",
4+
"type": "library",
5+
"license": "GPLv3",
6+
"authors": [
7+
{
8+
"name": "DevNIX",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"require": {
13+
"ext-curl": "*",
14+
"egulias/email-validator": "^2.1",
15+
"layershifter/tld-extract": "^2.0"
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"Devnix\\Mailcheck\\": "src/"
20+
}
21+
},
22+
"autoload-dev": {
23+
"psr-4": {
24+
"Devnix\\Mailcheck\\Tests\\": "tests/"
25+
}
26+
},
27+
"require-dev": {
28+
"phpunit/phpunit": "^8.4",
29+
"symfony/var-dumper": "^4.3",
30+
"phpstan/phpstan": "^0.11.19",
31+
"friendsofphp/php-cs-fixer": "^2.16"
32+
},
33+
"scripts": {
34+
"lint": "./vendor/bin/php-cs-fixer fix --diff --dry-run",
35+
"phpstan": "./vendor/bin/phpstan analyse -l 4 src tests",
36+
"phpunit": "./vendor/bin/phpunit",
37+
"fix": "./vendor/bin/php-cs-fixer fix",
38+
"test": [
39+
"@composer run lint",
40+
"@composer run phpstan",
41+
"@composer run phpunit"
42+
]
43+
}
44+
}

0 commit comments

Comments
 (0)