PHP code example of ddt / jobbot

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

    

ddt / jobbot example snippets


return [
    'openrouter_key'   => env('OPENROUTER_KEY'),
    'openrouter_model' => env('JOBBOT_AI_MODEL', 'nex-agi/nex-n2-pro:free'),
    'route_prefix'     => 'jobbot',           // Routes: /jobbot/query, /jobbot/resume
    'middleware'       => ['web', 'auth'],     // Change as needed
    'intents_path'     => null,               // null = package default, ya custom path
    'candidate_role'   => 'Candidate',        // Spatie role name
    'search_limit'     => 20,
    'cache_ttl'        => 5,                  // AI response cache (minutes)

    // Model class overrides
    'models' => [
        'user'      => \App\Models\User::class,
        'candidate' => \App\Models\Candidate::class,
        'skill'     => \App\Models\Skill::class,
    ],

    // UI Customization
    'ui' => [
        'bot_name'    => env('JOBBOT_NAME', 'Job Sphere Assistant'),
        'bot_initials'=> env('JOBBOT_INITIALS', 'JS'),
        'greeting'    => 'Namaste! 👋 Main <strong>Job Sphere Assistant</strong> hoon.',
        'quick_chips' => [
            ['label' => '🔍 Laravel Candidates', 'query' => 'Laravel developer candidates dhundo'],
            ['label' => '💼 React Jobs',          'query' => 'React ke liye jobs'],
            ['label' => '📄 Parse Resume',         'query' => 'Resume upload'],
            ['label' => '➕ Add Candidate',        'query' => 'Add candidate'],
            ['label' => '❓ Help',                 'query' => 'help'],
        ],
    ],
];

'intents_path' => base_path('jobbot/intents.json'),


// app/JobBot/SalaryCheckHandler.php

namespace App\JobBot;

use Ddt\JobBot\Contracts\JobBotHandlerInterface;
use Illuminate\Http\JsonResponse;

class SalaryCheckHandler implements JobBotHandlerInterface
{
    public function handle(string $lower, string $original, mixed $user): JsonResponse
    {
        // apna logic yahan
        return response()->json([
            'message' => '💰 Salary data yahan aayega!',
            'data'    => null,
        ]);
    }
}

// config/jobbot.php
'handlers' => [
    'salary_check'   => \App\JobBot\SalaryCheckHandler::class,
    'find_candidates'=> \App\JobBot\MyFindCandidatesHandler::class, // built-in override
],

// config/jobbot.php
'route_prefix' => 'chatbot',  // Ab /chatbot/query hoga
bash
php artisan jobbot:install
bash
php artisan vendor:publish --tag=jobbot-views
bash
# Sab kuch ek saath
php artisan vendor:publish --tag=jobbot

# Sirf config
php artisan vendor:publish --tag=jobbot-config

# Sirf views
php artisan vendor:publish --tag=jobbot-views

# Sirf intents JSON
php artisan vendor:publish --tag=jobbot-intents