Download the PHP package lingyun/think-rate-limiting without Composer

On this page you can find all versions of the php package lingyun/think-rate-limiting. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package think-rate-limiting

think-RateLimiter

基于 ThinkPHP 缓存实现的限流器,提供了一个简单的方法来限制指定时间内的任何操作。

安装

通过 Composer 包管理器安装 think-think-rate-limiting :

缓存配置

通常情况下,限流器使用你默认的缓存驱动,由 cache 配置文件中的 default 键定义。你也可以通过在你的应用程序的 cache 配置文件中定义一个 limiter 来指定限流器应该使用哪一个缓存来驱动:

基础用法

可以通过 think\facade\RateLimiter 来操作限流器。限流器提供的最简单的方法是 attempt 方法,它将一个给定的回调函数执行次数限制在一个给定的秒数内。

当回调函数执行次数超过限制时, attempt 方法返回 false ;否则 attempt 方法将返回回调的结果或 trueattempt 方法接受的第一个参数是一个速率限制器 key ,它可以是你选择的任何字符串,代表被限制速率的动作:

手动配置尝试次数

如果想手动与限流器交互,可以使用多种方法。例如,可以调用 tooManyAttempts 方法来确定给定的限流器是否超过了每分钟允许的最大尝试次数

或者,可以使用 remaining 方法检索给定密钥的剩余尝试次数。如果给定的密钥还有重试次数,可以调用 hit 方法来增加总尝试次数:

确定限流器可用性

当一个键没有更多的尝试次数时,availableIn 方法返回在更多尝试可用之前剩余的秒数:

清除尝试次数

可以使用 clear 方法重置给定速率限制键的尝试次数。例如,当接收者读取给定消息时,可以重置尝试次数:


All versions of think-rate-limiting with dependencies

PHP Build Version
Package Version
Requires topthink/framework Version ^6.0||^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lingyun/think-rate-limiting contains the following files

Loading the files please wait ....