Skip to content

Commit 04f4866

Browse files
authored
Merge branch 'egulias:4.x' into 4.x
2 parents ef0c5bb + dcf8f79 commit 04f4866

File tree

7 files changed

+98
-76
lines changed

7 files changed

+98
-76
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "composer"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/static-analysis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: static analysis
33
on:
44
push:
55
branches:
6-
- master
76
- '*.x'
87
pull_request:
98

.github/workflows/tests.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
name: build
1+
name: unit-tests
22

33
on:
44
push:
55
branches:
6-
- master
76
- '*.x'
87
pull_request:
9-
schedule:
10-
- cron: '0 0 * * *'
118

129
jobs:
1310
tests:
@@ -47,15 +44,10 @@ jobs:
4744

4845
- name: Execute tests
4946
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml --exclude-group flaky
50-
- name: Coverage
51-
if: ${{ matrix.php == '8.1' && matrix.deps == 'lowest' }}
52-
shell: bash
53-
env:
54-
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
55-
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r build/logs/clover.xml
5647

5748
- name: Store artifacts
49+
if: ${{ matrix.php == '8.1' && matrix.deps == 'lowest' }}
5850
uses: actions/upload-artifact@v4
5951
with:
60-
name: logs
61-
path: build/logs
52+
name: clover.xml
53+
path: build/logs
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: upload-coverage-to-codacy
2+
on:
3+
workflow_run:
4+
workflows: ["unit-tests"]
5+
types:
6+
- completed
7+
8+
jobs:
9+
upload:
10+
runs-on: ubuntu-latest
11+
if: >
12+
github.event.workflow_run.event == 'pull_request' &&
13+
github.event.workflow_run.conclusion == 'success'
14+
strategy:
15+
fail-fast: true
16+
name: upload-coverage
17+
18+
steps:
19+
- name: Setup logs directory
20+
run: mkdir -p build/coverage
21+
22+
- name: Download clover.xml artifact
23+
uses: actions/download-artifact@v3
24+
with:
25+
name: clover.xml
26+
path: build/coverage
27+
28+
- name: Upload Coverage to Codacy
29+
shell: bash
30+
env:
31+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
32+
33+
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r build/coverage/clover.xml

CHANGELOG.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.md

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,44 @@
33
[![Build Status](https://github.com/egulias/EmailValidator/actions/workflows/tests.yml/badge.svg)](https://github.com/egulias/EmailValidator/actions/workflows/tests.yml)
44
[![Quality Badge](https://app.codacy.com/project/badge/Grade/55d44898c7e44ebdb4e457523563ad63)](https://app.codacy.com/gh/egulias/EmailValidator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
55
[![Test Coverage](https://app.codacy.com/project/badge/Coverage/55d44898c7e44ebdb4e457523563ad63)](https://app.codacy.com/gh/egulias/EmailValidator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
6+
![Latest Release](https://img.shields.io/github/v/release/egulias/EmailValidator)
67

78
A library for validating emails against several RFC.
89

910
## Supported RFCs
1011

1112
This library aims to support RFCs:
1213

13-
* [5321](https://tools.ietf.org/html/rfc5321),
14-
* [5322](https://tools.ietf.org/html/rfc5322),
15-
* [6530](https://tools.ietf.org/html/rfc6530),
16-
* [6531](https://tools.ietf.org/html/rfc6531),
14+
* [5321](https://tools.ietf.org/html/rfc5321),
15+
* [5322](https://tools.ietf.org/html/rfc5322),
16+
* [6530](https://tools.ietf.org/html/rfc6530),
17+
* [6531](https://tools.ietf.org/html/rfc6531),
1718
* [6532](https://tools.ietf.org/html/rfc6532),
1819
* [1035](https://tools.ietf.org/html/rfc1035)
1920

2021
## Supported versions
2122

22-
**Current major version with full support is v3**
23-
2423
| Version | Released | EOL | Only critical bug fixes | Full |
2524
|:-------:|:----------:|:---:|:-----------------------:|:----:|
26-
| v4.x | 2023/01/07 | - | X | X |
27-
| v3.x | 2020/12/29 | - | X | |
25+
|**v4.x** |**2023/01/07** | - | **X** |**X** |
26+
| v3.x | 2020/12/29 | YES | | |
2827
| v2.1.x | 2016/05/16 | YES | | |
2928
| v1.2 | 2013/19/05 | YES | | |
3029

31-
3230
## Requirements
3331

34-
* PHP 8.1
35-
* [Composer](https://getcomposer.org) is required for installation
36-
* [Spoofchecking](/src/Validation/Extra/SpoofCheckValidation.php) and [DNSCheckValidation](/src/Validation/DNSCheckValidation.php) validation requires that your PHP system has the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl)
32+
* PHP 8.1
33+
* [Composer](https://getcomposer.org) is required for installation
34+
* [Spoofchecking](/src/Validation/Extra/SpoofCheckValidation.php) and
35+
[DNSCheckValidation](/src/Validation/DNSCheckValidation.php) validation
36+
requires that your PHP system has the
37+
[PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php)
38+
(also known as PHP Intl)
3739

38-
**Note**: `PHP version upgrades will happen to accomodate to the pace of major frameworks. Minor versions bumps will go via minor versions of this library (i.e: PHP7.3 -> v3.x+1). Major versions will go with major versions of the library`
40+
**Note**: `PHP version upgrades will happen to accomodate to the pace of major
41+
frameworks. Minor versions bumps will go via minor versions of this library
42+
(i.e: PHP7.3 -> v3.x+1). Major versions will go with major versions
43+
of the library`
3944

4045
## Installation
4146

@@ -47,9 +52,12 @@ composer require egulias/email-validator
4752

4853
## Getting Started
4954

50-
`EmailValidator` requires you to decide which (or combination of them) validation/s strategy/ies you'd like to follow for each [validation](#available-validations).
55+
`EmailValidator` requires you to decide which (or combination of them)
56+
validation/s strategy/ies you'd like to follow for each
57+
[validation](#available-validations).
5158

5259
A basic example with the RFC validation
60+
5361
```php
5462
<?php
5563

@@ -60,17 +68,22 @@ $validator = new EmailValidator();
6068
$validator->isValid("[email protected]", new RFCValidation()); //true
6169
```
6270

63-
6471
### Available validations
6572

6673
1. [RFCValidation](/src/Validation/RFCValidation.php): Standard RFC-like email validation.
67-
2. [NoRFCWarningsValidation](/src/Validation/NoRFCWarningsValidation.php): RFC-like validation that will fail when warnings* are found.
68-
3. [DNSCheckValidation](/src/Validation/DNSCheckValidation.php): Will check if there are DNS records that signal that the server accepts emails. This does not entail that the email exists.
69-
4. [MultipleValidationWithAnd](/src/Validation/MultipleValidationWithAnd.php): It is a validation that operates over other validations performing a logical and (&&) over the result of each validation.
70-
5. [MessageIDValidation](/src/Validation/MessageIDValidation.php): Follows [RFC2822 for message-id](https://tools.ietf.org/html/rfc2822#section-3.6.4) to validate that field, that has some differences in the domain part.
71-
6. [Your own validation](#how-to-extend): You can extend the library behaviour by implementing your own validations.
72-
73-
*warnings: Warnings are deviations from the RFC that in a broader interpretation are accepted.
74+
2. [NoRFCWarningsValidation](/src/Validation/NoRFCWarningsValidation.php):
75+
RFC-like validation that will fail when warnings* are found.
76+
3. [DNSCheckValidation](/src/Validation/DNSCheckValidation.php):
77+
Will check if there are DNS records that signal that the server accepts emails. This does not entail that the email exists.
78+
4. [MultipleValidationWithAnd](/src/Validation/MultipleValidationWithAnd.php):
79+
It is a validation that operates over other validations performing a logical and (&&) over the result of each validation.
80+
5. [MessageIDValidation](/src/Validation/MessageIDValidation.php):
81+
Follows [RFC2822 for message-id](https://tools.ietf.org/html/rfc2822#section-3.6.4) to validate that field, that has some differences in the domain part.
82+
6. [Your own validation](#how-to-extend): You can extend the library behaviour
83+
by implementing your own validations.
84+
85+
*warnings: Warnings are deviations from the RFC that in a broader interpretation
86+
are accepted.
7487

7588
```php
7689
<?php
@@ -90,29 +103,38 @@ $validator->isValid("[email protected]", $multipleValidations); //true
90103
```
91104

92105
#### Additional validations
93-
Validations not present in the RFCs
94106

95-
1. [SpoofCheckValidation](/src/Validation/Extra/SpoofCheckValidation.php): Will check for multi-utf-8 chars that can signal an erroneous email name.
107+
Validations not present in the RFCs
108+
109+
1. [SpoofCheckValidation](/src/Validation/Extra/SpoofCheckValidation.php):
110+
Will check for multi-utf-8 chars that can signal an erroneous email name.
96111

97112

98113
### How to extend
99114

100-
It's easy! You just need to implement [EmailValidation](/src/Validation/EmailValidation.php) and you can use your own validation.
115+
It's easy! You just need to implement
116+
[EmailValidation](/src/Validation/EmailValidation.php) and you can use your own
117+
validation.
101118

102119
## Contributing
103120

104-
Please follow the [Contribution guide](CONTRIBUTING.md). Is short and simple and will help a lot.
121+
Please follow the [Contribution guide](CONTRIBUTING.md).
122+
Is short and simple and will help a lot.
105123

106124
## Other Contributors
107125

108-
(You can find current contributors [here](https://github.com/egulias/EmailValidator/graphs/contributors))
126+
(You can find current contributors
127+
[here](https://github.com/egulias/EmailValidator/graphs/contributors))
109128

110129
As this is a port from another library and work, here are other people related to the previous one:
111130

112-
* Ricard Clau [@ricardclau](https://github.com/ricardclau): Performance against PHP built-in filter_var (v2 and earlier)
113-
* Josepf Bielawski [@stloyd](https://github.com/stloyd): For its first re-work of Dominic's lib
114-
* Dominic Sayers [@dominicsayers](https://github.com/dominicsayers): The original isemail function
131+
* Ricard Clau [@ricardclau](https://github.com/ricardclau):
132+
Performance against PHP built-in filter_var (v2 and earlier)
133+
* Josepf Bielawski [@stloyd](https://github.com/stloyd):
134+
For its first re-work of Dominic's lib
135+
* Dominic Sayers [@dominicsayers](https://github.com/dominicsayers):
136+
The original `isemail` function
115137

116138
## License
117139

118-
Released under the MIT License attached with this code.
140+
Released under the MIT License attached with this code.

tests/EmailValidator/Validation/RFCValidationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ public static function getInvalidEmails()
150150
['\r\n \r\n [email protected]'],
151151
152152
['examp║[email protected]'],
153+
154+
153155
['0'],
154156
[0],
155157
];

0 commit comments

Comments
 (0)