darsyn/ip
Laravel package for working with IP addresses: parse and validate IPv4/IPv6, compare and normalize formats, check ranges and subnet/CIDR matches, and convert between representations. Useful for request filtering, geo/security rules, and logging.
to* (conversions), keeping get*
for component and property accessors. Keep the get* spellings as deprecated
aliases; getBinary() is exempt as the accessor of the canonical state.Contracts\StrategyDetectionInterface
deprecating the old IpInterface::isEmbedded() and associated methods.fromInteger()/toInteger() via
the new Contracts\Factory4Interface (IPv4 and Multi only), plus
arbitrary-precision fromIntegerString()/toIntegerString() and fixed-width
toHexString() on all classes.Util\Binary:
toDecimalString() and fromDecimalString() (GMP fast path when the
extension is loaded, backed by pure-PHP fallback).Contracts\OutputInterface from \JsonSerializable.Contracts\OutputInterface: getOctets(), getSegments(), and
canonical toString() (deferable method for Stringable equivalent).next(), previous() and offset(int $offset)
to Contracts\ArithmeticInterface. Over/underflowing the address space throws
Exception\OverflowException.Strategy\CanonicalEmbeddingInterface bridge.Contracts\FactoryInterface interface:
try/from protocol, binary, hex.factory() in favour of the strict named constructors
fromProtocol()/fromBinary().[@experimental](https://github.com/experimental) capability interfaces under Darsyn\IP\Contracts\.
Their shape may change before 7.0, but remains backwards compatible for 6.xFormatter\ProtocolFormatterInterface parameter on toDotAddress(),
toCompactedAddress() and toProtocolAppropriateAddress() (deprecated
get* aliases accept the same argument, but any other value triggers a
deprecation notice and falls back to the global formatter instead of
throwing a TypeError).AbstractIP::generateBinaryMask()
to the public static Util\Binary::mask().getNetworkIp() / getBroadcastIp())
and the greatest common CIDR (getCommonCidr()) directly on raw bytes.Util\Binary: increment(), decrement() and
addIntegerOffset(). Over/underflowing throws new exception.$previous constructor argument on all exception classes from
?\Exception to ?\Throwable.8.5 in README, and GitHub Action CI workflows.8.5.5.0.2).7.4) and latest (8.5) for running
static analysis.[@phpstan-ignore](https://github.com/phpstan-ignore)
instructions.4.2.2).MbString::subString() from swallowing valid 0.fc00::/7 block as private use.SECURITY.md, CODE_OF_CONDUCT.md and
CONTRIBUTING.md2002::/16, RFC
3056 § 2), not just canonical 6to4 addresses with a zeroed 80-bit tail.isPublicUse(), isUnicastGlobal() and isDocumentation()
with the IANA special-purpose address registries, and update RFC
references/citations for all address classification methods.isPublicUse() to isGloballyReachable(), conforming to the official
wording used in the IANA special-purpose address registries ("Public Use"
does not appear in them). Keep isPublicUse() as a deprecated alias.64:ff9b::/96), operator Network-specific Prefixes,
and the RFC 8215 Local-use prefix (64:ff9b:1::/48).Teredo embedding strategy for 2001::/32 (according to RFC 4380 § 4).Composite embedding strategy that recognises and extracts version 4
addresses across several underlying strategies, while packing through a single
canonical strategy.64:ff9b::/96, RFC 6052 § 2.1)
address by the version 4 address it embeds rather than trusting the prefix, so
an embedded non-globally-reachable address is no longer reported as globally
reachable (closes a potential SSRF deny-list bypass).develop/master to 6.x; branch 5.x from
5.0.0 tag for ongoing support (bugfixes only). Update GitHub Actions CI
workflows, and update README with description on the 6.x/5.x split.7.1.8.4 deprecation errors (nullable arguments must be explicit).
5.0.1added PHP8.4support, but this is deprecated due to true support (without supresing deprecation warnings) being unavailable without lifting the minimum PHP version (5.6).PHP
8.4is now only supported (officially) on6.x.
8.4 support for the 5.x branch. Highest PHP
version supported for 5.x is 8.3, upgrade to 6.x for higher PHP versions.composer.json and GitHub Action CI
workflows.[@phpstan-ignore](https://github.com/phpstan-ignore) instruction for non-issue in unit tests.8.4.darsyn/ip-doctrine.
List it as a Composer dependency suggestion.max level (standard,
deprecation, and bleeding edge rules).8.2 and 8.3 in CI pipeline.ctype PHP extension.IpInterface::equals() method for comparing two IP addresses.getCommonCidr(IpInterface $ip): int for determining how in range two
IP addresses are according to their common CIDR value.isBenchmarking(), isDocumentation(), and isPublicUse() type
methods for both IPv4 and IPv6 addresses.isBroadcast(), isShared(), and isFutureReserved() type methods for
IPv4 addresses.getMulticastScope(), isUniqueLocal(), isUnicast(), and
isUnicastGlobal() type methods for IPv6 addresses.Ipv6::fromEmbedded() factory method to create an instance of an
IPv4-embedded address as IPv6 instead of Multi.Darsyn\IP\Util\Binary and Darsyn\IP\Util\MbString.symfony/error-handler
from throwing deprecation errors__toString() to IP objects.How can I help you explore Laravel packages today?