PHP code example of techrays-labs / laravel-debt-tracker

1. Go to this page and download the library: Download techrays-labs/laravel-debt-tracker 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/ */

    

techrays-labs / laravel-debt-tracker example snippets


'ci' => [
    'fail_on_grade' => 'C',
    'max_score'     => 500,
],

// config/debt-tracker.php

return [
    'scan_paths' => ['app'],
    'exclude_paths' => ['app/Http/Middleware'],

    'thresholds' => [
        'method_length'        => 30,   // lines
        'class_length'         => 500,  // lines
        'max_public_methods'   => 20,
        'nesting_depth'        => 4,
        'complexity_per_method'=> 10,
    ],

    'cost' => [
        'hours_per_point' => 0.25,
        'hourly_rate'     => null, // set to show $ estimates
    ],

    'detectors' => [
        'todos'        => true,
        'complexity'   => true,
        'coverage'     => true,
        'dependencies' => true,
        'git_age'      => true,
        'n1_queries'   => true,
        'security'     => true,
        'dead_code'    => true,
    ],

    'n1_ignore_properties'     => ['id', 'uuid', 'created_at', 'updated_at', 'deleted_at'],
    'security_exclude_paths'   => ['tests', 'database/seeders'],
    'dead_code_ignore_methods' => [],

    'export' => [
        'path'      => base_path('DEBT_REPORT.md'),
        'json_path' => base_path('DEBT_REPORT.json'),
    ],
];

use Illuminate\Support\Facades\Schedule;

Schedule::command('debt:scan')->daily();

'pulse' => [
    'enabled' => false,
],
bash
php artisan vendor:publish --tag=debt-tracker-config
bash
php artisan debt:scan
bash
php artisan debt:scan --export=markdown
bash
php artisan debt:scan --export=json
bash
php artisan debt:scan --export=markdown,json
bash
php artisan debt:summary
# [Techrays Debt Tracker] Grade: C | Score: 412 | Est: 103h | Files: 312
# Exit code: 1 (C), 0 (A/B), 2 (D/F) — gate your pipeline on debt grade
bash
php artisan debt:scan --path=app/Services
bash
php artisan debt:show-file app/Services/PaymentService.php
php artisan debt:show-class "App\Services\PaymentService"
bash
php artisan vendor:publish --tag=debt-tracker-pulse-views
bash
php artisan debt:scan