I just did a quick test, and with Laravel 11.41.0, using PHP 8.3.16, composer 2.8.4.
laravel new excel-project
cd excel-project
composer require maatwebsite/excel
It worked just fine, no errors.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm having trouble installing Laravel Excel.
When I use this composer require maatwebsite/excel I get the error Method Illuminate\Foundation\Application::share does not exist. when publishing. And when I use this composer require "maatwebsite/excel:^3.1" I get the following error Your requirements could not be resolved to an installable set of packages.
Problem 1 - Root composer.json requires maatwebsite/excel 3.1 -> satisfiable by maatwebsite/excel[3.1.0]. - maatwebsite/excel 3.1.0 requires php ^7.0 -> your php version (8.2.8) does not satisfy that requirement.```
I appreciate any help I can get.
I just did a quick test, and with Laravel 11.41.0, using PHP 8.3.16, composer 2.8.4.
laravel new excel-project
cd excel-project
composer require maatwebsite/excel
It worked just fine, no errors.
@Tray2 I did too the error only shows up when I try to publish the configuration file \config\app.php file
@j_watson Look at the error again. Most likely it says a bit more than what you posted
Also you said it failed on install in the first post and now you say it fails on publishing the config file? Which is it?
@Sinnbeck I tried installing it two ways:
composer require maatwebsite/excel fails when I publish the config\app.phpcomposer require "maatwebsite/excel:^3.1" fails when installing.Here is the error message for the second option:
- Root composer.json requires maatwebsite/excel 3.1 -> satisfiable by maatwebsite/excel[3.1.0].
- maatwebsite/excel 3.1.0 requires php ^7.0 -> your php version (8.2.12) does not satisfy that requirement. ```
@j_watson Not sure why number 2 fails. Maybe you have something wrong with your composer cache. You can try composer clear-cache
But if you already installed it without any errors using 1. then there might not be a point. So the error you are getting with 1. Isnt there more to the error ?
Based on your first post, it sounds like you are calling app()->share() or similar somewhere in your code. Try searching your files for share
@Sinnbeck I think 2 fails quite frequently since they added it in their documentation. Afterwards, they suggest using composer require maatwebsite/excel which installs version 1.1. Which gives me this error Method Illuminate\Foundation\Application::share does not exist when I try to publish the app.php file
@j_watson Can you share your composer.json ?
@Sinnbeck the app()->share() error is referring to this function
protected function bindClasses() { // Bind the format identifier $this->app['excel.identifier'] = $this->app->share(function($app) { return new FormatIdentifier($app['files']); }); } from file:///.../vendor/maatwebsite/excel/src/Maatwebsite/Excel/ExcelServiceProvider.php#L154
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": [
"laravel",
"framework"
],
"license": "MIT",
"require": {
"php": "^8.2",
"barryvdh/laravel-dompdf": "^3.1",
"laravel/framework": "^11.31",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.5",
"maatwebsite/excel": "^1.1",
"phpoffice/phpspreadsheet": "^3.9",
"simplesoftwareio/simple-qrcode": "~4"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.3",
"laravel/pail": "^1.1",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"pestphp/pest": "^3.7",
"pestphp/pest-plugin-laravel": "^3.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"npm run dev\" --names='server,queue,vite'"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
@j_watson Try the following
"maatwebsite/excel": "^1.1", to "maatwebsite/excel": "^3.1",composer update@Sinnbeck I'm still getting this error Method Illuminate\Foundation\Application::share does not exist.
@j_watson Are you sure you dont have that share code inside your own code? I have searched through the code of maatwebsite/excel v. 3.1 and I cannot find that code anywhere..
https://github.com/search?q=repo%3ASpartnerNL%2FLaravel-Excel%20bindClasses&type=code
@Sinnbeck composer require maatwebsite/excel installed version 1.1 I tried upgrading to 3.48.1 but that share error keeps popping up even when I run composer run dev
@j_watson Yes. Again please find out where it is defined. It isnt in the latest maatwebsite/excel. Also the newest version is 3.1.62 not 3.48.1
Please or to participate in this conversation.