<?php
 namespace TechSoft\Laravel\Firewall; use TechOnline\Laravel\Http\Request; use TechOnline\Laravel\RateLimit\RedisRateLimiter; class RateLimiterUtil { private static $ins = null; private static function instance() { if (null === self::$ins) { self::$ins = new RedisRateLimiter(); } return self::$ins; } public static function permit($key, $limit = 60, $window = 60) { return self::instance()->permit($key, $limit, $window); } public static function permitUrl($limit = 60, $window = 60) { return self::permit('RL:' . Request::path(), $limit, $window); } public static function permitBizUrl($biz, $limit = 60, $window = 60) { return self::permit('RL:' . $biz . ':' . Request::path(), $limit, $window); } }