File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,23 @@ analysis purposes. Use the ``anonymize()`` method from the
362362 $anonymousIpv6 = IpUtils::anonymize($ipv6);
363363 // $anonymousIpv6 = '2a01:198:603:10::'
364364
365+ If you need even more anonymization, you can use the second and third parameters
366+ of the ``anonymize() `` method to specify the number of bytes that should be
367+ anonymized depending on the IP address format::
368+
369+ $ipv4 = '123.234.235.236';
370+ $anonymousIpv4 = IpUtils::anonymize($ipv4, v4Bytes: 3);
371+ // $anonymousIpv4 = '123.0.0.0'
372+
373+ $ipv6 = '2a01:198:603:10:396e:4789:8e99:890f';
374+ $anonymousIpv6 = IpUtils::anonymize($ipv6, v6Bytes: 10);
375+ // $anonymousIpv6 = '2a01:198:603::'
376+
377+ .. versionadded :: 7.2
378+
379+ The ``v4Bytes `` and ``v6Bytes `` parameters of the ``anonymize() `` method
380+ were introduced in Symfony 7.2.
381+
365382Check If an IP Belongs to a CIDR Subnet
366383~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
367384
You can’t perform that action at this time.
0 commit comments