Laravel-Excel: Target [Maatwebsite\Excel\Exporter] is not instantiable.

Versions

  • PHP version: 7.3.5
  • Laravel version: 5.8.18
  • Package version: 3.1.13

Description

Here my export files

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\Exportable;

class TestExport implements FromArray, WithHeadings
{
    use Exportable;

    public function headings(): array
    {
        return [
            'id',
            'name'
        ];
    }

    public function array(): array
    {
        return [
            1,
            'John Doe'
        ];
    }
}
return (new TestExport())->download('test.csv', \Maatwebsite\Excel\Excel::CSV, [
    'Content-Type' => 'text/csv',
]);

I’m getting following error:

Target [Maatwebsite\Excel\Exporter] is not instantiable.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

@SumantaBee

Go to your config/app.php file and add Maatwebsite\Excel\ExcelServiceProvider::class to the list of the providers

For some reason the auto discover for only this package doesnt work while im running the tests…

I keep getting this error:

Illuminate\Contracts\Container\BindingResolutionException: Target [Maatwebsite\Excel\Importer] is not instantiable.