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

Php Ip Laravel Package

rlanvin/php-ip

PHP library for working with IPv4 and IPv6 addresses as objects, with subnet and range support. Parse, validate, and manipulate addresses, convert between formats, and calculate networks and masks through a clean, well-tested API.

Deep Wiki
Context7

rlanvin/php-ip is a PHP library for working with IPv4 and IPv6 addresses as first-class objects. It offers a consistent API for parsing, formatting, comparing, and performing arithmetic on addresses, with arbitrary-precision support via GMP for large IPv6 values.

  • Create addresses from strings, integers, or binary data
  • Add/subtract offsets and calculate address ranges
  • Work with subnets, CIDR notation, and network masks
  • Compare addresses and check containment
  • Handle IPv4/IPv6 conversion and validation
Frequently asked questions about Php Ip
How do I install rlanvin/php-ip in a Laravel application?
Install it with Composer using composer require rlanvin/php-ip. Laravel does not need a service provider or config file for basic use. You can use the classes directly, but binding a small adapter or service in the container is recommended so package types do not spread through controllers and domain code.
Does rlanvin/php-ip have a Laravel service provider?
No, it is a framework-agnostic PHP library with no Laravel-specific integration. That is fine for a leaf utility because Laravel's Composer autoloading is enough. Register your own service provider only if you want to bind an IpAddressService or NetworkMatcher adapter.
What IP operations does rlanvin/php-ip support?
It supports IPv4 and IPv6 parsing, validation, formatting, comparison, CIDR subnet calculations, range checks, and address arithmetic. That covers normalization, subnet membership tests, and range expansion. It is best treated as a focused utility rather than a domain model.
Can rlanvin/php-ip check whether an IP address is inside a CIDR range?
Yes, CIDR subnet calculations and range checks are core features of the library. In Laravel, put the check behind an adapter method such as isInCidr() rather than calling package classes directly from middleware. Add contract tests around boundary addresses and malformed input.
Is rlanvin/php-ip suitable for allowlists, denylists, and rate limiting?
It can support those cases, but security-sensitive decisions need extra validation. Test IPv4-mapped IPv6 addresses, CIDR boundary semantics, malformed input, and trusted-proxy behavior. For enforcement changes, run old and new logic in parallel in non-enforcing mode before switching.
Which PHP versions and Laravel versions work with rlanvin/php-ip?
The package is Composer-installable and framework-agnostic, so Laravel compatibility depends mainly on your PHP runtime. Because the last release was in March 2022, verify it against your application's PHP and Laravel test matrix, including PHP 8.1, 8.2, and 8.3 if those are in scope. Pin a known-good version in CI.
Is rlanvin/php-ip actively maintained?
The package has a reasonable maturity signal, but the last release date is 2022-03-02 and the repository is listed as unknown. Treat it as community-supported and assign an internal owner for IP and CIDR semantics. Monitor advisories and be prepared to fork or replace it if upstream remains inactive.
How should I use rlanvin/php-ip in Laravel middleware for client IP checks?
Resolve the client IP from Laravel's trusted request handling, not directly from raw X-Forwarded-For headers unless you have explicitly configured trusted proxies. Pass that IP into a small adapter that uses rlanvin/php-ip for normalization and CIDR matching. Keep the middleware thin and test deny and allow paths with IPv4 and IPv6 cases.
Can rlanvin/php-ip replace ip2long, inet_pton, filter_var, or custom CIDR logic?
It can consolidate many ad hoc IPv4 and IPv6 operations behind a clearer object-oriented API. Inventory existing call sites first, then migrate low-risk utilities before security rules. Keep compatibility tests that compare old and new results during the migration.
What are alternatives to rlanvin/php-ip for Laravel projects?
Framework utilities such as Symfony's IpUtils can handle simple CIDR checks, and other Composer IP libraries exist for broader needs. Evaluate alternatives on IPv6 behavior, maintenance status, and how well they fit your PHP matrix. If you already wrap IP logic in an adapter, swapping libraries later is much easier.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console