Class yii\helpers\IpHelper

Inheritanceyii\helpers\IpHelper » yii\helpers\BaseIpHelper
Available since version2.0.14
Source Code

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

MethodDescriptionDefined 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


Hide inherited constants

ConstantValueDescriptionDefined 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