bhagat / excel
Supercharged Excel exports and imports in Laravel
v1.0.0
2023-07-04 10:42 UTC
Requires
- php: ^7.0|^8.0
- ext-json: *
- composer/semver: ^3.3
- illuminate/support: 5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0
- phpoffice/phpspreadsheet: ^1.18
- psr/simple-cache: ^1.0|^2.0|^3.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0
- predis/predis: ^1.1
This package is auto-updated.
Last update: 2024-12-16 16:07:27 UTC
README
Generate excel/csv
Command
Run - composer require bhagat/excel:dev-master
Code
web.php / Controller
use App\Exports\ExportUser;
Route::get('/excel', function(){
return Excel::download(new ExportUser, 'users.xlsx');
});
App\Exports\ExportUser.php
namespace App\Exports;
use App\Models\User;
use Bhagat\Excel\Concerns\FromCollection;
class ExportUser implements FromCollection {
public function collection()
{
return User::select('name','email')->get();
}
}