|
return in_array($ip, abuse_ips(), true); |
Why do you do an in_array check here instead of an array_key_exists? You probably want to flip this whole array so you can do a key lookup in O(1). It is horribly inefficient to use an array lookup this way since the abuse-ip array consists of over 53k IPs (and this middleware runs on every request).
Laravel-Abuse-IP/src/helpers.php
Line 23 in 114d1fe
Why do you do an
in_arraycheck here instead of anarray_key_exists? You probably want to flip this whole array so you can do a key lookup in O(1). It is horribly inefficient to use an array lookup this way since the abuse-ip array consists of over 53k IPs (and this middleware runs on every request).