-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.travis.yml export-ignore |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
composer.lock | ||
composer.phar | ||
vendor |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013 Lucas Michot [[email protected]] and other contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,284 @@ | ||
# Unaliaser | ||
|
||
A PHP library to track, de-duplicate and un-alias Google Mail and Google Apps emails. | ||
|
||
[](https://packagist.org/packages/lucasmichot/unaliaser) | ||
[](https://packagist.org/packages/lucasmichot/unaliaser) | ||
[](https://travis-ci.org/lucasmichot/unaliaser) | ||
|
||
* [Requiring/Loading](#requiringloading) | ||
* [Methods](#methods) | ||
* [__construct()](#__construct) | ||
* [cleanEmail()](#cleanEmail) | ||
* [domainName()](#domainName) | ||
* [isGmail()](#isGmail) | ||
* [isGoogleApps()](#isGoogleApps) | ||
* [isGoogle()](#isGoogle) | ||
* [uniqueDomainName()](#uniqueDomainName) | ||
* [userName()](#userName) | ||
* [userAlias()](#userAlias) | ||
* [hasUserAlias()](#hasUserAlias) | ||
* [userOrigin()](#userOrigin) | ||
* [userUndottedOrigin()](#userUndottedOrigin) | ||
* [unique()](#unique) | ||
* [userIsDotted()](#userIsDotted) | ||
* [isUnique()](#isUnique) | ||
* [Tests](#tests) | ||
* [License](#license) | ||
|
||
## Requiring / Loading | ||
|
||
If you're using Composer to manage dependencies, you can include the following | ||
in your `composer.json` file: | ||
|
||
"require": { | ||
"unaliaser/unaliaser": "dev-master" | ||
} | ||
|
||
Then, after running `composer update` or `php composer.phar update`, you can | ||
load the class using Composer's autoloading: | ||
|
||
```php | ||
require 'vendor/autoload.php'; | ||
``` | ||
|
||
Otherwise, you can simply require the file directly: | ||
|
||
```php | ||
require_once 'path/to/Unaliaser/src/Unaliaser/Unaliaser.php'; | ||
``` | ||
|
||
## Methods | ||
|
||
#### __construct() | ||
|
||
Creates a new instance of `Unaliaser`. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
``` | ||
|
||
**If the email is not valid, an `InvalidArgumentExcpetion` will be thrown.** | ||
|
||
#### cleanEmail() | ||
|
||
Returns a clean email. | ||
|
||
```php | ||
$unaliaser = new Unaliaser(' [email protected] '); | ||
echo $unaliaser->cleanEmail(); | ||
// '[email protected]' | ||
``` | ||
|
||
#### domainName() | ||
|
||
Returns a the domain name for the email. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->domainName(); | ||
// 'bar.com' | ||
``` | ||
|
||
#### isGmail() | ||
|
||
Check if an email is managed by Google Mail. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGmail(); | ||
// true | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGmail(); | ||
// false | ||
``` | ||
|
||
#### isGoogleApps() | ||
|
||
Check if an email is managed by Google Apps. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGoogleApps(); | ||
// false | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGoogleApps(); | ||
// false | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGoogleApps(); | ||
// true | ||
``` | ||
|
||
#### isGoogle() | ||
|
||
Check if an email is managed by Google (Gmail or Google Apps). | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGoogle(); | ||
// true | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGoogle(); | ||
// false | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isGoogle(); | ||
// true | ||
``` | ||
|
||
#### uniqueDomainName() | ||
|
||
Get the unique domain name for a Gmail address. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->uniqueDomainName(); | ||
// 'gmail.com' | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->uniqueDomainName(); | ||
// 'googlemail.com' | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->uniqueDomainName(); | ||
// 'yahoo.com' | ||
``` | ||
|
||
#### mxRecords() | ||
|
||
Get the MX records for the domain name of an email address. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
print_r($unaliaser->mxRecords()); | ||
// display an array containing various MX records for the domain of this email address | ||
``` | ||
|
||
#### userName() | ||
|
||
Get the username for an email address. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userName(); | ||
// 'johndoe' | ||
``` | ||
|
||
#### userAlias() | ||
|
||
Get the user alias for a Google address, if any. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userAlias(); | ||
// 'dummyalias' | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userAlias(); | ||
// null | ||
``` | ||
|
||
#### hasUserAlias() | ||
|
||
Determines if a Google email address contains an user alias. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->hasUserAlias(); | ||
// false | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->hasUserAlias(); | ||
// true | ||
``` | ||
|
||
#### userOrigin() | ||
|
||
Get the original username for a email. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userOrigin(); | ||
// 'johndoe+alias' | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userOrigin(); | ||
// 'johndoe' | ||
``` | ||
|
||
#### userUndottedOrigin() | ||
|
||
Get the original un-dotted username for a Google address. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userUndottedOrigin(); | ||
// 'john.doe' | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userUndottedOrigin(); | ||
// 'johndoe' | ||
``` | ||
|
||
|
||
#### userIsDotted() | ||
|
||
Determines if a Google address is dotted. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userIsDotted(); | ||
// false | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->userIsDotted(); | ||
// true | ||
``` | ||
|
||
#### unique() | ||
|
||
Get the unique email address. | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->unique(); | ||
// '[email protected]' | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->unique(); | ||
// '[email protected]' | ||
``` | ||
|
||
#### isUnique() | ||
|
||
Determines if the provided email is unique (dotted or aliased). | ||
|
||
```php | ||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isUnique(); | ||
// true | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isUnique(); | ||
// false | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isUnique(); | ||
// false | ||
|
||
$unaliaser = new Unaliaser('[email protected]'); | ||
echo $unaliaser->isUnique(); | ||
// true | ||
``` | ||
|
||
## Tests | ||
|
||
From the project directory, tests can be ran using `phpunit` | ||
|
||
## License | ||
|
||
Released under the MIT License - see `LICENSE.txt` for details. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "lucasmichot/uuid62", | ||
"type": "library", | ||
"description": "generate a unique Uuid from a value, using base 62.", | ||
"keywords": [ | ||
"uuid", | ||
"base", | ||
"62", | ||
"identifier" | ||
], | ||
"homepage": "https://github.com/lucasmichot/uuid62", | ||
"authors": [ | ||
{ | ||
"name": "Lucas Michot", | ||
"email": "[email protected]", | ||
"homepage": "http://semalead.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.3.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "3.7.*" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Uuid62": "src" | ||
} | ||
}, | ||
"license": "MIT" | ||
} |