Skip to content

Commit

Permalink
Fixed namespace and updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MASNathan committed Aug 24, 2021
1 parent ec291df commit d0ebecb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

This is an easy way to check if a email address is acceptable so you can avoid fake/invalid users on your database.

What this API does is check if the email address is correctly formatted, is from a disposable or temporary service and the domain is reachable. This way you can filter out spam and one-shot accounts decreasing the rate of fake or invalid accounts on your database.
What this API does is check if the email address is correctly formatted, is from a disposable or temporary service and
the domain is reachable. This way you can filter out spam and one-shot accounts decreasing the rate of fake or invalid
accounts on your database.

## Installation

Expand All @@ -20,8 +22,20 @@ composer require masnathan/email-validator
## Usage

```php
$email-validator = new Masnathan\EmailValidator();
echo $email-validator->echoPhrase('Hello, Masnathan!');
use MASNathan\EmailValidator\EmailValidator;

$emailValidator = new EmailValidator('email-validator8.p.rapidapi.com', 'super-secret-api-key');

$details = $emailValidator->check('[email protected]');

var_dump($details);
// array:5 [
// "email" => "[email protected]"
// "valid" => true
// "disposable" => false
// "mx_records" => true
// "exists" => null
// ]
```

## Testing
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
},
"autoload": {
"psr-4": {
"Masnathan\\EmailValidator\\": "src"
"MASNathan\\EmailValidator\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Masnathan\\EmailValidator\\Tests\\": "tests"
"MASNathan\\EmailValidator\\Tests\\": "tests"
}
},
"scripts": {
"psalm": "vendor/bin/psalm",
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes src/"
},
"config": {
"sort-packages": true
Expand Down
2 changes: 1 addition & 1 deletion src/EmailValidator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Masnathan\EmailValidator;
namespace MASNathan\EmailValidator;

use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;
Expand Down
4 changes: 2 additions & 2 deletions tests/EmailValidatorTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Masnathan\EmailValidator\Tests;
namespace MASNathan\EmailValidator\Tests;

use GuzzleHttp\Client;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use Masnathan\EmailValidator\EmailValidator;
use MASNathan\EmailValidator\EmailValidator;
use PHPUnit\Framework\TestCase;

class EmailValidatorTest extends TestCase
Expand Down

0 comments on commit d0ebecb

Please sign in to comment.