Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

isadma's avatar

use Eloquent ORM and Yajra datatable in plain php

I want use yajra datatable in plain php. A installed the yajradatable.

composer require yajra/laravel-datatables

Then I tried this code:


<?php

    require "config/config.php";

    use Yajra\DataTables\Facades\DataTables;


    //Validation is eloquent model
    $validations = Validation::query();

    echo DataTables::of($validations)->json();

I am getting this error:

Fatal error: Uncaught RuntimeException: A facade root has not been set. in C:\wamp64\www\eloquent\vendor\illuminate\support\Facades\Facade.php on line 258
0 likes
3 replies
isadma's avatar

It is plain php, not Laravel project. I want to use it on plain php.

Please or to participate in this conversation.