Laravel 11 with Yajra Datatables: Export Features for CSV, Excel, PDF, and Print

Raviya Technical
4 min readOct 15, 2024

Yajra Datatables: Installation Guide for Laravel

composer require yajra/laravel-datatables:^11.0 

Troubleshooting Yajra Datatables Installation: Solutions for Common Issues

composer require yajra/laravel-datatables:^11.0 --ignore-platform-reqs

Using Laravel UI Package

composer require laravel/ui --dev
php artisan ui bootstrap --auth

Using Laravel without Package

npm i @popperjs/core bootstrap sass

Change in vite.config.js file

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: ['resources/sass/app.scss', 'resources/css/app.css', 'resources/js/app.js',],
refresh: true,
}),
],
});

If Bootstrap 5

npm i laravel-datatables-vite --save-dev

This will install the following packages:

- Bootstrap Icons
- DataTables with Buttons and Select plugins for Bootstrap 5
- Laravel DataTables custom scripts

Changes/Check resources/js/app.js

import './bootstrap';
import 'laravel-datatables-vite';

--

--

No responses yet