PHP code example of fr3on / laravel-ledger

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

    

fr3on / laravel-ledger example snippets


use Fr3on\Ledger\Facades\Ledger;

$result = Ledger::for(user: $user, feature: 'chat')
    ->budget()->dailyLimit(tokens: 50_000)->orFail()
    ->track(fn() => $ai->generate($prompt));
bash
php artisan ledger:report --period=month
bash
php artisan vendor:publish --tag=ledger-config