PHP code example of aksoom-hussain / kaveh

1. Go to this page and download the library: Download aksoom-hussain/kaveh 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/ */

    

aksoom-hussain / kaveh example snippets


use Kaveh\Kaveh;

public function checkout(Order $order): void
{
    try {
        $this->payment->charge($order);
    } catch (\Throwable $e) {
        Kaveh::track('checkout.failed', [
            'order_id' => $order->id,
            'customer_id' => $order->customer_id,
            'gateway' => $order->payment_gateway,
            'reason' => $e->getMessage(),
        ], tags: ['billing', 'checkout'], level: 'error');

        throw $e;
    }

    Kaveh::track('checkout.completed', [
        'order_id' => $order->id,
        'total' => $order->total,
    ], tags: ['billing', 'checkout']);
}

// app/Providers/KavehServiceProvider.php
Gate::define('viewKaveh', function ($user) {
    return in_array($user->email, [
        '[email protected]',
    ], true);
});

// routes/console.php or Kernel
Schedule::command('kaveh:prune-events')->daily();
Schedule::command('kaveh:evaluate-alerts')->everyMinute();
bash
php artisan kaveh:install --role=both --mode=local --non-interactive
php artisan migrate
php artisan serve
# Visit /kaveh/login
bash
php artisan kaveh:install --role=both --mode=both \
  --server-url="${APP_URL}" --non-interactive
bash
composer kaveh:install --role=client --mode=remote \
  --server-url=https://kaveh.yourcompany.com \
  --api-key=kv_xxxxxxxx \
  --non-interactive
php artisan queue:work   # supervisord / Horizon in production