Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README/Docs #90

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,32 @@ accuracy or readability of the documentation - are always welcome.

Full documentation is available in the [`docs/`](docs/) folder.

## Code of Conduct
## Compatibility

This project includes and adheres to the [Contributor Covenant as a Code of
Conduct](CODE_OF_CONDUCT.md).
This library has extensive test coverage using PHPUnit on PHP versions: `5.6`,
`7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`, `8.2`, and `8.3`.

## Upgrading
Static analysis is performed with PHPStan at `max` level on PHP `8.3`, using
both core and deprecation rules.

This library is fairly similar to how it was in `3.3.1`; the main differences
are:
The Doctrine features included in this library are compatible with Doctrine DBAL
`^2.3 || ^3.0`. This is **not** enforced via Composer (in case you want to use
this library in a project that uses Doctrine DBAL `4+` without using the
Doctrine features this library provides).

- There are three main classes instead of one: [`IPv4`](src/Version/IPv4.php),
## Brief Example

- There are three main classes: [`IPv4`](src/Version/IPv4.php),
[`IPv6`](src/Version/IPv6.php), and [`Multi`](src/Version/Multi.php) (for both
version 4 and 6 addresses).
- Objects are created using a static factory method
[`IpInterface::factory()`](src/IpInterface.php) instead of the constructor to
speed up internal processes.
- A few methods have been renamed (see [the API reference](docs/09-api.md)).
- Finally, the default for representing version 4 addresses internally has
changed [from IPv4-compatible to IPv4-mapped](docs/05-strategies.md).

## Brief Example
- When using `Multi`, the default strategy for representing version 4 addresses
internally is [IPv4-mapped](docs/05-strategies.md).

```php
<?php
<?php declare(strict_types=1);

use Darsyn\IP\Exception;
use Darsyn\IP\Version\IPv4;
Expand All @@ -55,6 +57,11 @@ if (!$ip->isPrivateUse()) {
}
```

## Code of Conduct

This project includes and adheres to the [Contributor Covenant as a Code of
Conduct](CODE_OF_CONDUCT.md).

# License

Please see the [separate license file](LICENSE.md) included in this repository
Expand Down
6 changes: 4 additions & 2 deletions docs/08-doctrine.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Doctrine Support

This library can be used to support IP address as column types with Doctrine.
This library can be used to support IP address as column types with Doctrine
DBAL versions `^2.3 || ^3.0`.

Three Doctrine types are provided to match the three version classes:

- `Darsyn\IP\Doctrine\IPV4Type` supports the `IPv4` class.
Expand Down Expand Up @@ -31,7 +33,7 @@ Now you can happily store IP addresses in your entities like nobody's business:
use Darsyn\IP\Version\Multi as IP;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Entity]
class AnalyticsEntity
{
#[ORM\Column(type: 'ip')]
Expand Down
Loading