PHP code example of zaimealabs / ranks

1. Go to this page and download the library: Download zaimealabs/ranks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zaimealabs / ranks example snippets


    $model = Rank::model(Match::class)
        ->between(
            start: now()->startOfYear(),
            end: now()->endOfYear(),
        )
        ->select(['user_id'])
        ->rank('scored');

    $query = Rank::query(Match::whereNotNull('user_id'))
        ->between(
            start: now()->startOfYear(),
            end: now()->endOfYear(),
        )
        ->select(['user_id'])
        ->rank('scored')

    $query = Rank::query(Match::where('type', 'csgo'))
        ->dateColumn('played_at')
        ->between(
            start: now()->startOfYear(),
            end: now()->endOfYear())
        ->select(['user_id'])
        ->rankTime('duration');

->select(['name', 'csgo'])

->dateColumn('pointed_date_column')

->rankAlias('score_rank')

->sumAlias('score_sum')