Skip to content

Commit c3c8569

Browse files
Initial Commit
1 parent 86c900e commit c3c8569

13 files changed

+387
-1
lines changed

Diff for: .scrutinizer.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
filter:
2+
excluded_paths: [tests/*]
3+
4+
checks:
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
19+
20+
tools:
21+
external_code_coverage: true

Diff for: .travis.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: php
2+
3+
php:
4+
- 5.5.9
5+
- 5.5
6+
- 5.6
7+
- 7.0
8+
- hhvm
9+
10+
matrix:
11+
allow_failures:
12+
- php: 7.0
13+
- php: hhvm
14+
15+
install: travis_retry composer install --no-interaction --prefer-source
16+
17+
script:
18+
- phpunit --coverage-text --coverage-clover=coverage.clover
19+
20+
after_script:
21+
- wget https://scrutinizer-ci.com/ocular.phar
22+
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
23+
24+
notifications:
25+
slack: red-creek:5lI8ybvl6YTcCNPosh4TE13h

Diff for: CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
### 1.0.1
4+
- Added helper functions
5+
- Bump up php version to 5.5+
6+
7+
### 1.0.0
8+
- First Stable release

Diff for: CONTRIBUTING.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
We accept contributions via Pull Requests on [Github](https://github.com/busayo/laravel-email-validator).
6+
7+
8+
## Pull Requests
9+
10+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
11+
12+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
13+
14+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
15+
16+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
17+
18+
- **Create feature branches** - Don't ask us to pull from your master branch.
19+
20+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
21+
22+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
23+
24+
25+
## Running Tests
26+
27+
You can run the tests with:
28+
29+
```bash
30+
vendor/bin/phpunit run
31+
```
32+
33+
34+
**Happy coding**!

Diff for: LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2015 Prosper Otemuyiwa <[email protected]>
4+
5+
> Permission is hereby granted, free of charge, to any person obtaining a copy
6+
> of this software and associated documentation files (the "Software"), to deal
7+
> in the Software without restriction, including without limitation the rights
8+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
> copies of the Software, and to permit persons to whom the Software is
10+
> furnished to do so, subject to the following conditions:
11+
>
12+
> The above copyright notice and this permission notice shall be included in
13+
> all copies or substantial portions of the Software.
14+
>
15+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
> THE SOFTWARE.

Diff for: README.md

+85-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,86 @@
11
# laravel-emailVerifier
2-
Validate email addresses on the fly in Laravel
2+
3+
[![Latest Stable Version](https://poser.pugx.org/busayo/laravel-yearly/v/stable.svg)](https://packagist.org/packages/busayo/laravel-yearly)
4+
![](https://img.shields.io/badge/unicodeveloper-approved-brightgreen.svg)
5+
[![License](https://poser.pugx.org/busayo/laravel-yearly/license.svg)](LICENSE.md)
6+
[![Build Status](https://img.shields.io/travis/busayo/laravel-yearly.svg)](https://travis-ci.org/busayo/laravel-yearly)
7+
[![Quality Score](https://img.shields.io/scrutinizer/g/busayo/laravel-yearly.svg?style=flat-square)](https://scrutinizer-ci.com/g/busayo/laravel-yearly)
8+
[![Total Downloads](https://img.shields.io/packagist/dt/busayo/laravel-yearly.svg?style=flat-square)](https://packagist.org/packages/busayo/laravel-yearly)
9+
10+
> Laravel 5 Package to help keep your copyright year up-to-date. Simple but insanely useful.
11+
12+
## Install
13+
14+
[PHP](https://php.net) 5.5+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.
15+
16+
Via Composer
17+
18+
``` bash
19+
$ composer require unicodeveloper/laravel-emailVerifier
20+
```
21+
22+
Another alternative is to simply add the following line to the require block of your `composer.json` file.
23+
24+
```
25+
"unicodeveloper/laravel-emailVerifier": "1.0.*"
26+
```
27+
28+
Then run `composer install` or `composer update` to download it and have the autoloader updated.
29+
30+
Add this to your providers array in `config/app.php`
31+
32+
```php
33+
34+
// Laravel 5: config/app.php
35+
36+
'providers' => [
37+
...
38+
'Unicodeveloper\EmailValidator\EmailValidatorServiceProvider',
39+
...
40+
];
41+
```
42+
43+
This package also comes with a facade
44+
45+
```php
46+
47+
// Laravel 5: config/app.php
48+
49+
'aliases' => [
50+
...
51+
'EmailValidator' => 'Unicodeveloper\EmailValidator\EmailValidatorFacade',
52+
...
53+
]
54+
```
55+
56+
## Usage
57+
58+
## Change log
59+
60+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
61+
62+
## Testing
63+
64+
You can run the tests with:
65+
66+
```bash
67+
vendor/bin/phpunit run
68+
```
69+
70+
Alternatively, you can run the tests like so:
71+
72+
```bash
73+
composer test
74+
```
75+
76+
## Contributing
77+
78+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
79+
80+
## Credits
81+
82+
- [Prosper Otemuyiwa](https://twitter.com/unicodeveloper)
83+
84+
## License
85+
86+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Diff for: composer.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "unicodeveloper/laravel-email-validator",
3+
"description": "Provides helper function to validate and verify email addresses",
4+
"keywords": [
5+
"busayo",
6+
"laravel-email-validator",
7+
"laravel",
8+
"validate",
9+
"verify",
10+
"year",
11+
"email-validator",
12+
"email-verifier"
13+
],
14+
"homepage": "https://github.com/busayo/laravel-email-validator",
15+
"license": "MIT",
16+
"authors": [
17+
{
18+
"name": "unicodeveloper",
19+
"email": "[email protected]",
20+
"homepage": "http://goodheads.io",
21+
"role": "Developer"
22+
}
23+
],
24+
"require": {
25+
"php" : ">=5.5.9"
26+
},
27+
"require-dev": {
28+
"phpunit/phpunit" : "4.*",
29+
"scrutinizer/ocular": "~1.1"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"Unicodeveloper\\EmailValidator\\": "src"
34+
},
35+
"files": [
36+
"src/helpers.php"
37+
]
38+
},
39+
"autoload-dev": {
40+
"psr-4": {
41+
"Unicodeveloper\\EmailValidator\\Test\\": "tests"
42+
}
43+
},
44+
"scripts": {
45+
"test": "phpunit"
46+
},
47+
"extra": {
48+
"branch-alias": {
49+
"dev-master": "1.0-dev"
50+
}
51+
}
52+
}

Diff for: phpunit.xml.dist

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="laravel-yearly Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
<logging>
23+
<log type="tap" target="build/report.tap"/>
24+
<log type="junit" target="build/report.junit.xml"/>
25+
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
26+
<log type="coverage-text" target="build/coverage.txt"/>
27+
<log type="coverage-clover" target="build/logs/clover.xml"/>
28+
</logging>
29+
</phpunit>

Diff for: src/EmailValidator.php

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace Unicodeveloper\Yearly;
4+
5+
use InvalidArgumentException;
6+
7+
class YearAfterYear
8+
{
9+
/**
10+
* Gets the Current Year
11+
* @return integer
12+
*/
13+
public function current_year()
14+
{
15+
return date("Y");
16+
}
17+
18+
19+
20+
/**
21+
* returns a range of years when provided a start year
22+
* @param integer $start_year
23+
* @param string $separator
24+
* @return string
25+
* @throws \InvalidArgumentException
26+
*/
27+
public function year_range($start_year = 0, $separator = ' - ')
28+
{
29+
30+
if(! is_numeric($start_year)){
31+
throw new InvalidArgumentException("Invalid Argument Format passed . It should be a number");
32+
}
33+
34+
if( $start_year < 0){
35+
throw new InvalidArgumentException("Invalid Argument passed {$start_year} . It shouldn't be a negative value");
36+
}
37+
38+
if( $start_year == 0){
39+
return $this->current_year();
40+
}
41+
42+
return ($start_year == $this->current_year()) ? $this->current_year() : $start_year . $separator . $this->current_year();
43+
}
44+
}

Diff for: src/EmailValidatorFacade.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Unicodeveloper\Yearly;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
class YearlyFacade extends Facade
8+
{
9+
/**
10+
* Get the registered name of the component.
11+
*
12+
* @return string
13+
*/
14+
protected static function getFacadeAccessor()
15+
{
16+
return 'laravel-yearly';
17+
}
18+
}

Diff for: src/EmailValidatorServiceProvider.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace Unicodeveloper\EmailValidator;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
7+
class EmailValidatorServiceProvider extends ServiceProvider
8+
{
9+
10+
/**
11+
* Indicates if loading of the provider is deferred.
12+
*
13+
* @var bool
14+
*/
15+
protected $defer = false;
16+
17+
/**
18+
* Register the application services
19+
* @return void
20+
*/
21+
public function register()
22+
{
23+
$this->app->bind('laravel-email-validator', function(){
24+
25+
return new EmailValidator;
26+
27+
});
28+
}
29+
30+
/**
31+
* Get the services provided by the provider
32+
* @return array
33+
*/
34+
public function provides()
35+
{
36+
return ['laravel-email-validator'];
37+
}
38+
}

Diff for: src/helpers.php

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+

0 commit comments

Comments
 (0)