Делал всё по инструкции
Ввёл эту команду
composer require maatwebsite/excel:^3.1
Получил ошибку
our 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.
В инструкции сказано, если получаете, эту ошибку, то "Можно попробовать просто установить без курсора"
composer require maatwebsite/excel
Зарегистрировал ServiceProvider в config/app.php
Maatwebsite\Excel\ExcelServiceProvider::class,
Добавил Фасад в config/app.php 'Excel' => Maatwebsite\Excel\Facades\Excel::class,
Чтобы опубликовать команду
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider" --tag=config
получаю ошибку
BadMethodCallException
Method Illuminate\Foundation\Application::share does not exist.
at vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:113
109▕ */
110▕ public function __call($method, $parameters)
111▕ {
112▕ if (! static::hasMacro($method)) {
➜ 113▕ throw new BadMethodCallException(sprintf(
114▕ 'Method %s::%s does not exist.', static::class, $method
115▕ ));
116▕ }
117▕
i Bad Method Call: Did you mean Illuminate\Foundation\Application::isShared() ?
1 vendor\maatwebsite\excel\src\Maatwebsite\Excel\ExcelServiceProvider.php:154
Illuminate\Foundation\Application::__call()
2 vendor\maatwebsite\excel\src\Maatwebsite\Excel\ExcelServiceProvider.php:58
Maatwebsite\Excel\ExcelServiceProvider::bindClasses()
Не смог разобраться как установить или включить
PHP extension php_zip enabled, вроде так " extension=zip"
PHP extension php_xml enabled
PHP extension php_gd2 enabled, вроде так "extension=gd"
PHP extension php_iconv enabled
PHP extension php_simplexml enabled
PHP extension php_xmlreader enabled
PHP extension php_zlib enabled
composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"league/flysystem-aws-s3-v3": "^3.0",
"maatwebsite/excel": "^3.1.48",
"phpoffice/phpspreadsheet": "^2.0",
"pusher/pusher-php-server": "^7.2"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.20",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.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"
]
},
"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
}