I'm trying to implement automated backup in Laravel 8. I decided to go with the Laravel-backup package "spatie/laravel-backup".
The problem occurs when I try to install the package with "composer require spatie/laravel-backup".
I get this problem :
Problem 1 - spatie/laravel-backup[8.1.0, ..., v8.x-dev] require illuminate/console ^9.0 -> found illuminate/console[v9.0.0-beta.1, ..., 9.x-dev] but these were not loaded, likely because it conflicts with another require. - Root composer.json requires spatie/laravel-backup ^8.1 -> satisfiable by spatie/laravel-backup[8.1.0, 8.1.1, 8.1.2, v8.x-dev].
I tried running those commands from similar questions answers nothing changed:
-composer require spatie/laravel-backup "^8.1" --ignore-platform-reqs
-composer require spatie/laravel-medialibrary
Also I tried deleting vendor and composer.lock and then running composer install and the problem still persists.
I guess there is a problem in my composer.json file :
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"ext-gd": "*",
"ext-json": "*",
"aws/aws-sdk-php": "~3.0",
"darkaonline/l5-swagger": "^8.1",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"league/flysystem-aws-s3-v3": "^1.0",
"maatwebsite/excel": "^3.1",
"tymon/jwt-auth": "^1.0",
"ext-pdo": "*"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
},
"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
},
"minimum-stability": "dev",
"prefer-stable": true
}
Thanks to everyone who takes the time to look at my problem. :))
Based on comments, install the correct version of Laravel Backup. Solved this problem.
composer require spatie/laravel-backup:7.0
Related
i am using mpdf laravel (carlos-meneses/laravel-mpdf) package but when I run the pdf i get the following error
Declaration of Mpdf\Mpdf::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void
I have tried to change psr/log to "^1.1 || ^2.0" in composer.lock because when I install the package mpdf it requires it. but it does not work and here is my composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"anhskohbo/no-captcha": "^3.4",
"carlos-meneses/laravel-mpdf": "^2.1",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"laravel/framework": "^9.19",
"laravel/sanctum": "^2.14.1",
"laravel/tinker": "^2.7",
"mcamara/laravel-localization": "^1.7",
"spatie/laravel-permission": "^5.5"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.11",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": [
"app/Helpers/helper.php"
]
},
"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": []
}
},
}
It is the fault of the wrapper library that it lets you install incompatible versions of dependencies. As Nico Haase mentions in a comment above, the issue has already been mitigated in the library.
On a side note, you never alter the composer.lock file manually. Changes made will be overwritten with the next composer install call. You need to force psr/log to version 2.x in your composer.json file, as answered in your previous question.
I wanted to use the the
composer require osiset/laravel-shopify
but the issue is I'm running in laravel 8, I wanted to downgrade my laravel 9.2 to laravel 8.0 but when I tried downgrading it by changing the composer.json into
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4.1",
"fruitcake/laravel-cors": "^2.0.3",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/passport": "^10.0",
"laravel/tinker": "^2.5|dev-develop",
"paragonie/random_compat": "2.*"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
but I'm getting these kind of errors
In Facade.php line 178:
Facade does not implement getFacadeAccessor method.
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
I'm new to laravel and I don't know what to do... thank you
You can specify the version you want easily by running
composer create-project laravel/laravel="5.1.*" myProject
Firstly, Degrade your php version from 8.1 to 7.3.
Secondly, Create new laravel project with following instruction.
composer create-project laravel/laravel:^8.0 example-app
Thirdly, move blade, controller, route, model and so on from old project to new project.
I am trying to install spatie laravel newsletter package but i am getting an error message
Problem 1
- Root composer.json requires spatie/laravel-newsletter ^4.9 -> satisfiable by spatie/laravel-newsletter[4.9.0].
- spatie/laravel-newsletter 4.9.0 requires illuminate/support ^6.0|^7.0|^8.0 -> found illuminate/support[v6.0.0, ..., 6.x-dev,
v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded,
likely because it conflicts with another require.
Installation failed, reverting ./composer.json and ./composer.lock to
their original content.
my composer.json file looks like this
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"gufy/pdftohtml-php": "~2",
"intervention/image": "^2.5",
"jenssegers/agent": "^2.6",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"maatwebsite/excel": "^3.1"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Not able to understand how to resolve the issue. I can't upgrate laravel 5.8 to 8 because it will take a lot of time.
Go to the Packagist page for spatie/laravel-newsletter and find a version of the package that supports Laravel 5.8.
Looks like 4.8.2 will do:
Run composer require "spatie/laravel-newsletter:~4.8.2".
Whenever I try to install "unisharp/laravel-filemanager" using composer in a fresh Laravel environment I get the following issues.
https://puu.sh/FqzWP/ff3f22090c.png
https://puu.sh/FqzTJ/dc7e35be88.png
https://puu.sh/FqzUd/156f987ba1.png
https://puu.sh/FqzUL/e50b127661.png
https://puu.sh/FqzVb/dd5c552d21.png
To reproduce this all I have to do is run the following commands to setup a fresh Laravel project...
composer global require laravel/installer
laravel new MyNewLaravelWebsite
cd MyNewLaravelWebsite
composer require unisharp/laravel-filemanager
For whatever reason if I simply run "composer require unisharp/laravel-filemanager" outside of the MyNewLaravelWebsite folder the command works, but isn't applied in my Laravel project (obviously)...
My PHP version is 7.4.3. Here is my composer.json also...
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
I found that version 1.9.2 of the package provided support for Laravel 7/7.3. So instead of installing 2.0 I installed 1.9.2 and this worked... I'm guessing support for Laravel 7 in the package version 2 will come later.... Here is how to require the correct package.
composer require unisharp/laravel-filemanager 1.9.2
Hope this helps someone.
I downgraded my application from 5.5 to 5.4 and i am getting this error when i run php artisan serve
Call to undefined method App\Console\Kernel::load() - Laravel 5.4
Looking at other solutions, i run composer dump-autoload to resolve this issue but the issue persist. Same error. I don't really know if this is caused by my packages in the composer.json file posted below
What could i do to resolve this now?
Thanks in advance
Composer.Json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"barryvdh/laravel-dompdf": "0.8.*",
"fideloper/proxy": "~4.0",
"guzzle/guzzle": "~3.0",
"laravel/framework": "5.4.*",
"laravel/passport": "^3.0",
"laravel/tinker": "~1.0",
"laravelcollective/html": "~5.0",
"maatwebsite/excel": " ~2.1.0",
"pda/pheanstalk": "~2.0",
"picqer/php-barcode-generator": "^0.2.0",
"spatie/laravel-permission": "^2.12",
"yajra/laravel-datatables-oracle": "~8.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"nunomaduro/collision": "~1.1",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories",
"app/commands",
"app/models",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
The issue is you did not ensure you updated your code to be Laravel 5.4 compatible.
In the Kernel.php boilerplate that comes with Laravel 5.5+ there's the line
$this->load(__DIR__.'/Commands');
This command was added in 5.5 to automatically detect any commands in the app/Console/Commands directory.
In order to get this code to work in 5.4 you need to remove that line and register all your commands manually under the protected $commands = [ ] array in the same file.
The source code for load is in https://github.com/laravel/framework/blob/5.5/src/Illuminate/Foundation/Console/Kernel.php#L196 if you want to try to adapt it and put it in your own Kernel.php
Delete vendor folder and composer.lock file after run composer install command
Go to your_project/app/Console/Kernel.php and remove line
$this->load(DIR.'/Commands');
in commands() function