PHP code example of mouadbnl / laravel-judge0

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

    

mouadbnl / laravel-judge0 example snippets


use Mouadbnl\Judge0\Models\Submission;

$submission = Submission::create([
        'language_id' => 54, // C++ (GCC 9.2.0)
        'source_code' =>'
        #ered is : " << s;
            return 0;
        }
        '
    ])
    ->setInput('judge0')
    ->setExpectedOutput('the value you entered is : judge0')
    ->setTimeLimit(1) // seconds
    ->setMemoryLimitInMegabytes(256)
    ->submit();

use Mouadbnl\Judge0\Traits\Submitter;
class User extends Authenticatable
{
    use Submitter;
    /** **/
}

$user = User::firstOrFail();
$user->submissions()->create([
        'language_id' => 54, // C++ (GCC 9.2.0)
        'source_code' =>'
        #e value you entered is : " << s;
            return 0;
        }
        '
    ])
    ->setInput('judge0')
    ->setExpectedOutput('the value you entered is : judge0')
    ->setTimeLimit(1) // seconds
    ->setMemoryLimitInMegabytes(256)
    ->submit();
bash
php artisan vendor:publish --provider="Mouadbnl\Judge0\Judge0ServiceProvider" --tag="judge0-migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="Mouadbnl\Judge0\Judge0ServiceProvider" --tag="judge0-config"