# Class yii\helpers\IpHelper

Inheritance | yii\helpers\IpHelper » yii\helpers\BaseIpHelper
Available since version | 2.0.14
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/helpers/IpHelper.php

Class IpHelper provides a set of IP-related static methods.

Methods expect correct IP addresses. To validate IP addresses use IpValidator.

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
expandIPv6() | Expands an IPv6 address to it's full notation. | yii\helpers\BaseIpHelper
getIpVersion() | Gets the IP version. Does not perform IP address validation. | yii\helpers\BaseIpHelper
inRange() | Checks whether IP address or subnet $subnet is contained by $subnet. | yii\helpers\BaseIpHelper
ip2bin() | Converts IP address to bits representation. | yii\helpers\BaseIpHelper

## Constants

Hide inherited constants

Constant | Value | Description | Defined By
--- | --- | --- | ---
IPV4 | 4 |  | yii\helpers\BaseIpHelper
IPV4_ADDRESS_LENGTH | 32 | The length of IPv4 address in bits | yii\helpers\BaseIpHelper
IPV6 | 6 |  | yii\helpers\BaseIpHelper
IPV6_ADDRESS_LENGTH | 128 | The length of IPv6 address in bits | yii\helpers\BaseIpHelper