Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ip Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Utilities

Binary Utility

The IP value objects store their internal state as a binary string, which is not easy for humans to understand. The Darsyn\IP\Util\Binary class is a collection of static helper methods for dealing with such binary strings.

From Hexadecimal

[@throws](https://github.com/throws) \InvalidArgumentException

\Darsyn\IP\Util\Binary::fromHex(string $hex): string

Because there are two hexadecimal characters per byte, the input string must be of a length that is a multiple of 2.

<?php
use Darsyn\IP\Util\Binary;

$hexString = '48656c6c6f21';
Binary::fromHex($hexString); // string("Hello!")

To Hexadecimal

[@throws](https://github.com/throws) \InvalidArgumentException

\Darsyn\IP\Util\Binary::toHex(string $hex): string
<?php
use Darsyn\IP\Util\Binary;

$binaryString = 'Hello!';
Binary::toHex($binaryString); // string("48656c6c6f21")

From Human-readable Binary

[@throws](https://github.com/throws) \InvalidArgumentException

\Darsyn\IP\Util\Binary::fromHumanReadable(string $asciiBinarySequence): string

Because there are 8 bits per bytes, the input string must be of a length that is a multiple of 8.

<?php
use Darsyn\IP\Util\Binary;

$asciiBinary = '010010000110010101101100011011000110111100100001';
Binary::fromHumanReadable($asciiBinary); // string("Hello!")

To Human-readable

[@throws](https://github.com/throws) \InvalidArgumentException

\Darsyn\IP\Util\Binary::toHumanReadable(string $binary): string
<?php
use Darsyn\IP\Util\Binary;

$binaryString = 'Hello!';
Binary::toHumanReadable($asciiBinary); // string("010010000110010101101100011011000110111100100001")

Multibyte String Utility

On some PHP installations, the Multibyte String extension can overload PHP's native string functions which, because we are working with arbitrary binary content, can incorrectly guess an encoding when attempting to transform this data (IP addresses have no text encoding).

Because of this, the Darsyn\IP\Util\MbString class is a collection of static helper equivalents for PHP's core string functions which detect if the mbstring extension is installed and appropriately call the correct function, specifying the 8bit text encoding (treat each byte as individual character) if required.

Static Helper Method Replaces the PHP function...
MbString::getLength() str_len()
MbString::subString() substr()
MbString::padString() str_pad()
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin