PHP code example of artjoker / laravel-scoring

1. Go to this page and download the library: Download artjoker/laravel-scoring 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/ */

    

artjoker / laravel-scoring example snippets


php artisan vendor:publish --provider="Artjoker\LaravelScoring\ScoringServiceProvider" --tag="config"

$result = Scoring::scoring('risk_tools', $attributes);

$result = [
    "group" => 4,
    "score" => 0.495,
    "amount_limit_max" => 1200,
    "amount_limit" => 1000.0,
    "filters" => [],
    "score_model" => [
        "version" => "v1_7"
    ]
]

$result = Scoring::ubkiReport('risk_tools', ['public_id' => $public_id]);

$result = Scoring::pre_scoring('risk_tools', ['social_number' => $social_number]);

    use Artjoker\LaravelScoring\Traits\ScoringTrait;

    class Loan extends Model
    {
        use ScoringTrait;
        ...
        
        public function scoringAttributes()
        {
            $client_data = json_decode($this->attributes['client_data']);
            $this->attributes['client_id']  = trim($client_data->id); 
            $this->attributes['inn']        = trim($client_data->code); 
            $this->attributes['lastName']   = trim($client_data->lastName); 
            ...
        }
    }