Download the PHP package wangjian/ranking without Composer

On this page you can find all versions of the php package wangjian/ranking. 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 ranking

ranking

利用redis zset数据结构实现的实时排行榜库。支持多种排行榜功能,例如总排行,日排行,周排行等等。方便扩展,可以根据自己的需要定义其他排行榜功能,只需要继承排行榜基类,实现几个函数就可以了。

Build Status

安装

使用

基本用法

使用Provider给Ranking提供数据,目前支持三种Provider:AllProvider、PageProvider和GeneratorProvider。当数据量非常大时,为了防止内存溢出,尽量使用PageProvider或GeneratorProvider。下面分别列举这几种Provider的定义方法。

定义好Provider后,我们就可以实例化排行榜对象了

上面的示例中,所有排行榜都用的同一个Provider,但是在实际开发中,不同的排行旁,Provider通常是不同的,例如总排行榜,Provider会读取数据库中所有的数据,但是日排行榜的Provider则只能读取当日入库的数据。

实例化Ranking对象之后,我们可以获取排行信息,还可以获取某人在排行榜中的具体排名,用法如下:

排行榜实例化的时候,我们会利用Provider初始化排行榜,初始化完成之后,如果有新记录入库,我们可以使用addItem方法来实时更新排行榜信息

注:排行榜分为实时的和非实时的,总排行榜、日排行榜、周排行榜、月排行榜是实时的;历史日排行榜、历史周排行榜、历史月排行榜是非实时的。addItem方法仅仅对实时排行榜生效,因此,我们可以无差别的对所有Ranking对象使用addItem方法而不破坏排行榜数据。

多个排行榜的管理

如果我们需要同时使用多个排行榜功能,我们就需要实例化多个Ranking对象,管理起来会很麻烦,我们可以使用RankingManager对象来统一管理。

自定义Ranking

如果现有的排行榜不能满足需求,可以自定义Ranking类,下面自定义一个小时排行榜。


All versions of ranking with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
predis/predis Version ^1.1.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 wangjian/ranking contains the following files

Loading the files please wait ....