Laravel-datatables: Class 'Yajra\Datatables\Facades\Datatables' not found

Created on 8 Dec 2015  ·  32Comments  ·  Source: yajra/laravel-datatables

Hello, Why i get this error :

Class 'Yajra\Datatables\Facades\Datatables' not found

Cause i never update anything.

My app.php is :

Yajra\Datatables\DatatablesServiceProvider::class,
'Datatables' => Yajra\Datatables\Datatables::class,

How to fix that?

Most helpful comment

@shairozan, the Facade file was removed on v6.0 and an alias was automatically registered in the service provider. You need to replace this use Yajra\Datatables\Facades\Datatables to just use Datatables or use Yajra\Datatables\Datatables instead for better IDE support.

All 32 comments

Change follwoing

Yajra\Datatables\DatatablesServiceProvider::class,
'Datatables' => Yajra\Datatables\Datatables::class,

to this

yajra\Datatables\DatatablesServiceProvider::class,
'Datatables' => yajra\Datatables\Datatables::class,

and try.

Still get Error,

Server Error
500

At the first time i install this version :

"yajra/laravel-datatables-oracle": "dev-develop"

May be any way to reset configuration??

try this

'yajra\Datatables\DatatablesServiceProvider',

remove ::class

Still got error :(
Here is my laravel logs :

[2015-12-08 14:15:36] local.CRITICAL: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'yajra\Datatables\DatatablesServiceProvider' not found' in /Applications/MAMP/htdocs/ulp3/bootstrap/cache/compiled.php:6916
Stack trace:
#0 {main} {"identification":{"id":"8593e01b-5cd9-4b85-9707-1fbaf2d10138"}} 

I installed "yajra/laravel-datatables-oracle": "~5.0"
its works fine.
dev-develop version not work for me

dev-develop uses Yajra\Datatables namespace which will be tagged as v6.0.0. For the facade, please use 'Datatables' => Yajra\Datatables\Datatables::class, atm.

hmm, I already change to

'Datatables' => Yajra\Datatables\Datatables::class

But it still not work.
And, finally i downgrade to

"yajra/laravel-datatables-oracle": "~5.0" 

It works now.
But I don't know why i get that error suddenly.

Thanks for your support :) :+1:

I'm actually still having this issue. Had to revert to 5 to get it to work, but I wouldn't say its fixed in 6.

@shairozan, the Facade file was removed on v6.0 and an alias was automatically registered in the service provider. You need to replace this use Yajra\Datatables\Facades\Datatables to just use Datatables or use Yajra\Datatables\Datatables instead for better IDE support.

This problem still seems to exist . On a Laravel 5.1.29 install i had to change Yajra\Datatables\DatatablesServiceProvider::class to yajra\Datatables\DatatablesServiceProvider::class in the providers array before it worked.

Version of yajra/laravel-datatables-oracle
{
"name": "yajra/laravel-datatables-oracle",
"version": "v6.0.0-alpha",
"source": {
"type": "git",
"url": "https://github.com/yajra/laravel-datatables.git",
"reference": "41e62d7febf28f901b10d68b953c4dadbb37b1e3"
},

Error seen when trying to do `php artisan vendor:publish --tag=datatables`

[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Yajra\Datatables\DatatablesServiceProvider' not found

Your requirements could not be resolved to an installable set of packages.

Problem 1
- laraveldaily/quickadmin 2.0.0 requires yajra/laravel-datatables-oracle ^6.18 -> satisfiable by yajra/laravel-datatables-oracle[v6.18.0, v6.18.1, v6.18.2, v6.19.0].
- laraveldaily/quickadmin 2.0.1 requires yajra/laravel-datatables-oracle ^6.18 -> satisfiable by yajra/laravel-datatables-oracle[v6.18.0, v6.18.1, v6.18.2, v6.19.0].
- laraveldaily/quickadmin 2.0.2 requires yajra/laravel-datatables-oracle ^6.18 -> satisfiable by yajra/laravel-datatables-oracle[v6.18.0, v6.18.1, v6.18.2, v6.19.0].
- yajra/laravel-datatables-oracle v6.18.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
- yajra/laravel-datatables-oracle v6.18.1 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
- yajra/laravel-datatables-oracle v6.18.2 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
- yajra/laravel-datatables-oracle v6.19.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
- dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- Installation request for laraveldaily/quickadmin ^2.0 -> satisfiable by laraveldaily/quickadmin[2.0.0, 2.0.1, 2.0.2].

To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/15-xml.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-curl.ini
- /etc/php/7.0/cli/conf.d/20-dom.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-mcrypt.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-simplexml.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
- /etc/php/7.0/cli/conf.d/20-wddx.ini
- /etc/php/7.0/cli/conf.d/20-xmlreader.ini
- /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
- /etc/php/7.0/cli/conf.d/20-xsl.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

I occasionally get this message even when it has been working fine up to that point.

For me, just running composer update fixes the issue.

just delete all files inside a bootstrap->cache folder. And run your project. Bug fixed.

Neither "yajra" nor "Yajra" works. I still have the error with Alaval 5.4 & Datatables v7.
It's been 3 hours I've been struggling with this library, it's exshausting.

@idmeneo sorry for the inconvenience. What are steps have you done so far? Are using a fresh installation or upgrading a project?

Some tips:

  1. Use composer show to double check which version of packages you are using.
  2. Delete all files under bootstrap/cache folder as suggested by @RBBarani.
  3. Delete vendor folder and reinstall all packages using composer install.

-- Edit --
"yajra" and "Yajra" namespace is a bit old issue from v5.x and below and I think is irrelevant on v7. Thanks!

Thx for the answer. I finally got it working by downgrading your module to v6.2 and updating all the other libraries.

Try removing syntactic sugar operators like tilde and caret sign in composer.json. Because sometimes they do not allow the exact version to install. The same problem happened to me also. Then run,

comoposer update

Solved the issue for me.

@wisnuvb Namespace and class name were updated on v8. Use DataTables instead of Datatables. See upgrade guide for ref.

right, I have not read the upgrade guide. once it's done. thank you

On v8, Run composer update and use this namespace use Yajra\DataTables\Facades\DataTables;

Changing from v6.0 to v8.0 forced me to change config/app.php
frro

         'Datatables' => Yajra\Datatables\Facades\Datatables::class,

to

        'Datatables' => Yajra\Datatables\Datatables::class,

and it worked fine afterwards.

Also, if used to automatically un-escape html elements, you'd have to publish the vendor package and change config/datatables.php

       /*
         * List of columns to be escaped. If set to *, all columns are escape.
         * Note: You can set the value to empty array to disable XSS protection.
         */
         'escape' => '*',

to

        'escape' => [],

@lexxyungcarter please see upgrade guide for ref.

Namespace and class name were updated on v8. Use DataTables instead of Datatables.

That worked

@victorsteven's solution worked on a fresh Laravel 5.6 + Datatables 8.7.0

This is use YajraDataTables\FacadesDataTables; working fine from my side thanks

I use composer require yajra/laravel-datatables-oracle command and change below line
yajraDatatablesDatatablesServiceProvider::class,
'Datatables' => yajraDatatablesDatatables::class,
It,s working.
Something like this https://appdividend.com/2018/04/16/laravel-datatables-tutorial-with-example/

Use this:

'Datatables' => YajraDataTables\FacadesDataTables::class, // Datatable

D and T should be capital.

I got this error when I was trying to remove the package. To clear the error, go to boostrap > cache and clear everything

YajraDataTablesDataTablesServiceProvider::class, in providers array
YajraDataTables\FacadesDataTables::class, in aliases array

use this one, it solved the issue for me

Im facing same issue here. code works perfectly on local, but I take it to server and my entire app fails to bootstrap.
steps taken.

  1. I copied yajra from my vendor to server
  2. Copied also published vendor config/datatables.php to server
  3. copied the composer and composer.lock
  4. cleared all in server bootstrap cache

im really frustrated after 2hrs of trying things im seeing here :(

After hrs of trying. I decided to re-upload local code which was working into my shared host server. and it works fine now. Thanks Yajra

I have the same problem with laravel 7 . I execute: php artisan config:cache
And my problem was result.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jgatringer picture jgatringer  ·  3Comments

sangnguyenplus picture sangnguyenplus  ·  3Comments

hari-web picture hari-web  ·  3Comments

hohuuhau picture hohuuhau  ·  3Comments

techguydev picture techguydev  ·  3Comments