-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from crwlrsoft/v1.0
V1.0
- Loading branch information
Showing
42 changed files
with
4,680 additions
and
14,933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.php_cs.dist export-ignore | ||
phpunit.xml export-ignore | ||
tests export-ignore | ||
git-hooks export-ignore | ||
bin/add-git-hooks export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
composer.lock | ||
vendor | ||
.php_cs.cache | ||
.phpunit.result.cache | ||
data/public_suffix_list.dat | ||
data/uri-schemes.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/bin']); | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@PSR2' => true, | ||
'strict_param' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'single_class_element_per_statement' => false, | ||
]) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [1.0.0] - 2020-05-11 | ||
|
||
### Added | ||
- Adapter class Uri that implements the PSR-7 `UriInterface`. | ||
- New methods in `Url` class: | ||
- `authority`: Get or set the full authority part of | ||
the url. | ||
- `userInfo`: Get or set the full userInfo part of the | ||
url. | ||
- `isRelativeReference`: Returns true when the current | ||
url is a relative reference. | ||
- `hasIdn`: Returns true when the current url contains | ||
an internationalized domain name in the host | ||
component. | ||
- `isEqualTo`: Compare the current url to another one. | ||
- `isComponentEqualIn`: Compare some component of the | ||
current url to the same component in another url. | ||
Also with separate methods for all available | ||
components: | ||
- `isSchemeEqualIn` | ||
- `isAuthorityEqualIn` | ||
- `isUserEqualIn` | ||
- `isPasswordEqualIn` | ||
- `isUserInfoEqualIn` | ||
- `isHostEqualIn` | ||
- `isDomainEqualIn` | ||
- `isDomainLabelEqualIn` | ||
- `isDomainSuffixEqualIn` | ||
- `isSubdomainEqualIn` | ||
- `isPortEqualIn` | ||
- `isPathEqualIn` | ||
- `isQueryEqualIn` | ||
- `isFragmentEqualIn` | ||
- New static validation methods in `Validator`: | ||
- `authority` | ||
- `authorityComponents` | ||
- `userInfo` | ||
- `userInfoComponents` | ||
- `user` | ||
- `password` (alias method `pass`) | ||
- `domainLabel` | ||
- `callValidationByComponentName` | ||
- Extracted parsing the host part (and registrable domain if | ||
contained) to separate classes `Host` and `Domain`. | ||
- New class `Helpers` with some static helper methods that | ||
are used in multiple several classes. Also static access | ||
to instances of classes `Suffixes` and `Schemes`. | ||
- New `InvalidUrlComponentException` that is thrown when | ||
you're trying to set an invalid new value for some | ||
component. | ||
|
||
### Changed | ||
- Required PHP version is now 7.2 because PHP 7.0 and 7.1 are | ||
no longer actively supported. | ||
- Instances of the Url class can now be created from relative | ||
references (without scheme). In v0.1 creating a new instance | ||
from a relative reference threw an Exception. If your | ||
application expects this behavior, you can use the | ||
`isRelativeReference` method of the `Url` object to find out | ||
if the url in question is a relative reference. | ||
- All methods in `Validator` are now static and all the | ||
component validation methods (scheme, host,...) now return | ||
`null` instead of `false` for invalid values. | ||
Further Validating a full url was split into 4 different | ||
methods: | ||
- `url`: Returns the validated url as string if input is | ||
valid (`null` if invalid). | ||
- `urlAndComponents`: Returns an array with validated url | ||
as string and all single validated url components ( | ||
`null` if invalid). | ||
- `absoluteUrl`: Same as `url` but only absolute urls are | ||
considered valid. | ||
- `absoluteUrlAndComponents`: Same as `urlAndComponents` | ||
but only absolute urls are valid. | ||
- Switch to `idn_to_ascii` and `idn_to_utf8` (respectively | ||
[symfony/polyfill-intl-idn](https://packagist.org/packages/symfony/polyfill-intl-idn) | ||
) to handle parse internationalized domain names. | ||
- `InvalidUrlException` now extends `UnexpectedValueException` | ||
instead of `Exception`. | ||
- Class `Store` is now abstract. | ||
|
||
### Removed | ||
- Method `compare` in `Url`. Use `isEqualTo` or the other new | ||
comparison methods listed under "Added" above. | ||
- Class `Parser`. Most still needed code is moved to `Helpers` | ||
class. | ||
- Move static method `getStandardPortByScheme` from class | ||
`Url` to class `Helpers`. | ||
- Method `userOrPassword` in `Validator`. Use methods `user` | ||
or `password` (`pass`) instead. | ||
|
||
### Fixed | ||
- Version 0.1 had an issue that path, query or fragment could | ||
have been double encoded in some cases. This shouldn't | ||
happen anymore (see method `encodePercentCharacter` in | ||
`Validator`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Contributing to this Package | ||
|
||
That you're reading this must mean you consider contributing to | ||
this package. So first off: Awesome! 👍🤘 | ||
|
||
## Bugs | ||
|
||
In case you encounter any bugs please | ||
[file an issue](https://github.com/crwlrsoft/url/issues/new). | ||
Describe the issue as well as you can and provide an example to | ||
reproduce it. | ||
Maybe you're not 100 percent sure whether what you've discovered | ||
is a bug or the intended behavior. You can still file an issue | ||
and tell us which results you'd expect. | ||
|
||
If you know how to fix the issue you're welcome to send a pull | ||
request. 💪 | ||
|
||
## New Features | ||
|
||
If you have ideas for new features you can tell us about it on | ||
[Twitter](https://twitter.com/crwlrsoft) or via | ||
[crwlr.software](https://www.crwlr.software/contact) or just | ||
send a pull request. Please keep in mind that there is no | ||
guarantee that your feature will be merged. | ||
|
||
## Conventions | ||
|
||
### Coding Style | ||
|
||
This package follows the | ||
[PSR-2](https://www.php-fig.org/psr/psr-2/) coding standard. | ||
Linting can be executed using the `composer cs` command. | ||
|
||
### Branching | ||
|
||
The repo contains branches for every minor version and a master | ||
branch up to date with the latest tagged version. For a bugfix | ||
please send your pull request to the branch of the latest version | ||
affected by the issue. If you're developing a new feature, branch | ||
out from the master branch. | ||
|
||
### Tests and linting | ||
|
||
When you're making changes to this package please always run | ||
tests and linting. Commands: | ||
`composer test` | ||
`composer cs` | ||
|
||
Ideally you add the pre-commit git hook that is shipped with | ||
this repo that will run tests and linting. Add it to your local | ||
clone by running: | ||
`composer add-git-hooks` | ||
|
||
Also please don't forget to add new test cases if necessary. | ||
|
||
### Documentation | ||
|
||
For any code change please don't forget to add an entry to the | ||
`CHANGELOG.md` file and in case it's necessary also change the | ||
`README.md` file. | ||
|
||
## Appreciation | ||
|
||
When your pull request is merged I will show some love and tweet | ||
about it. Also if you meet me in person I will be glad to buy you | ||
a beer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.