Symfony - (1/1) InvalidConfigurationException - Unrecognized option "mailer" under "framework" - php

I'm quite new at Symfony and struggle with this issue for my internship, when trying to run the project locally :
(1/1) InvalidConfigurationException
In ArrayNode.php line 331:
Unrecognized option "mailer" under "framework". Available options are "annotations", "assets", "cache", [...], "workflows".
I'm running PHP 7.4 and Symfony 4, adapting a symfony project from another dev.
In my .env file, I got swiftmailer bundle, I believe mailer was a different kind of mailer bundle used..?
I tried the following request :
composer require symfony/mailer
And got this :
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Using version ^5.2 for symfony/mailer
./composer.json has been updated
The "symfony/flex" plugin was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.
Running composer update symfony/mailer
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/mailer[v5.2.0, ..., v5.2.2] require symfony/event-dispatcher ^4.4|^5.0 -> found symfony/event-dispatcher[v4.4.0, ..., v4.4.19, v5.0.0, ..., v5.2.2] but the package is fixed to v4.2.8 (lock file version) by a partial up
date and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires symfony/mailer ^5.2 -> satisfiable by symfony/mailer[v5.2.0, v5.2.1, v5.2.2].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Thanks for your help !

If you're kickstarting another dev's project, you probably don't need any composer require. All you have to do is run composer install in project directory to get all the same packages, as previous developer.

Related

mpdf can not be installed in laravel 9

i am using laravel 9 and my PhP version is 8.0.2, and I am trying to install Mpdf package, so I write the following command
composer require mpdf/mpdf
but I get this error
Problem 1
- mpdf/mpdf[v8.1.0, ..., v8.1.2] require psr/log ^1.0 || ^2.0 -> found psr/log[1.0.0, ..., 1.1.4, 2.0.0] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires mpdf/mpdf ^8.1 -> satisfiable by mpdf/mpdf[v8.1.0, v8.1.1, v8.1.2].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
I have tried to delete the vendor and composer.lock and use composer update and it does work
mPDF is not compatible with psr/log 3.x because of support of older PHP versions (which do not have return type hints).
Previously installed Laravel is forcing psr/log library to version 3.x.
You can use flag --with-all-dependencies along with composer require mpdf/mpdf to downgrade the dependency automatically.
Alternatively, downgrade the psr/log library to 2.x - just add or change to "psr/log": "^2.0" line in your composer.json file and run composer update. This will resolve the issue.
Or you can first require mPDF and then Laravel, that should also work. Or require them both in one command.

How to instal phpDocumntor on Symfony4?

I'm trying to install phpDocumentor on my project, but I've got this problem.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpdocumentor/phpdocumentor[v3.1.0, ..., v3.1.2] require symfony/cache ^5.0 -> found symfony/cache[v5.0.0, ..., v5.3.7] but the package is fixed to v4.4.30 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires phpdocumentor/phpdocumentor ^3.1 -> satisfiable by phpdocumentor/phpdocumentor[v3.1.0, v3.1.1, v3.1.2].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
I really don't want to change my Symfony version and I haven't found the way to install the phpDoc on that project :c Do you have any ideas how to install it without changing my project version?
Taking a quick look at the phpDocumentor history, I don't think there's a version that'll be compatible with Symfony 4; they go from Symfony 2 on v2.9 to Symfony 5 on v3.0.
I'm not sure you'd want to tie up your project's requirements with those of an external tool like that, anyway.
I'd suggest using the phar distribution. If you want it included with your project when it's cloned, you can either commit it to the repo or download it with a Composer script on install.

Why can't I bind Elasticsearch and Laravel Scout?

I decided to test Elasticsearch in conjunction with Laravel Scout. I took this article as a basis
Attempt #1
composer require elasticsearch/elasticsearch - installing ES for Laravel
composer require laravel/scout - installing latest version for Scout (9.1)
composer require tamayo/laravel-scout-elastic - installing package for ES+Scout
I get this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- tamayo/laravel-scout-elastic[8.0.0, ..., 8.0.2] require laravel/scout ^8.0 -> found laravel/scout[v8.0.0, ..., 8.x-dev] but it conflicts with your root composer.json require (^9.1).
- Root composer.json requires tamayo/laravel-scout-elastic ^8.0 -> satisfiable by tamayo/laravel-scout-elastic[8.0.0, 8.0.1, 8.0.2].
I understand for myself that this bundle package has not been updated on github for six months and it is necessary to get to it the necessary version of laravel/scout, so I change the order of actions and do so:
Attempt #2
composer require elasticsearch/elasticsearch - installing ES for Laravel
composer require tamayo/laravel-scout-elastic - installing this package hoping that he will get the necessary version of laravel/scout for himself as a dependency, in confirmation of this - I see in the console that he pulled up laravel/scout:8.6.1
Now no mistakes, I'm moving on:
I go to config/app.php and add:
Laravel\Scout\ScoutServiceProvider::class,
ScoutEngines\Elasticsearch\ElasticsearchProvider::class,
Run php artisan vendor:publish
And now I get new error:
Class 'ScoutElastic\ScoutElasticServiceProvider' not found
What am I doing wrong?
Solution: don't add ScoutEngines\Elasticsearch\Elastic search Provider:: class, to config/app.php
Everything works fine without adding this provider

Failed while installing a package using composer

iam tryin to use a cart package by using this command
composer require jason-napolitano/codeigniter4-cart-module
and it's failed. this is what it said
Using version dev-master for jason-napolitano/codeigniter4-cart-module
./composer.json has been updated
Running composer update jason-napolitano/codeigniter4-cart-module
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires jason-napolitano/codeigniter4-cart-module dev-master -> satisfiable by jason-napolitano/codeigniter4-cart-module[dev-master].
- jason-napolitano/codeigniter4-cart-module dev-master requires codeigniter4/framework ^4.0.3 -> satisfiable by codeigniter4/framework[v4.0.3, ..., v4.1.1] from composer repo (https://repo.packagist.org) but codeigniter4/framework[1.0.0+no-version-set] from root package repo has higher repository priority. The
packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
is it because my minimum-stability in composer.json is set to "stable"?
I presume you created your project by using composer create-project codeigniter4/framework. This effectively created a clean project for you without the .git folder, thus removing any metadata on what version of codeigniter4/framework package you installed. This is indicative by 1.0.0+no-version-set part of the error message.
The jason-napolitano/codeigniter4-cart-module package requires ^4.0.3 version of codeigniter4/framework, but since you have no version metadata in your project, install fails. This can be resolved by setting the version from which you bootstrapped your project manually in your root composer.json:
{
"name": "codeigniter4/framework",
"version": "4.0.3",
...
}
However, this is just a guess, since I have no insight into your main composer.json.
Your PHP is missing intl extension. It is useful for formatting currency, number and date/time as well as UCA-conformant collations, for message formatting and normalizing text..etc.
Check out Codeignitor 4 [Documentation][1]:
Follow the steps to install it in XAMPP -
Open [xampp_folder_path]/php/php.ini to edit.
Search for ;extension=intl and remove the ;.
Save the php.ini file and restart Apache.

Problem with TravisCI version matrix after updating to composer 2.0

After updating to Composer 2.0 I got into problems on doing my Travis.
I have a TYPO3 Extension, that I want to test with multiple TYPO3 Versions. Till yesterday I could do this with composer require nimut/typo3-complete:$TYPO3_VERSION (coming from the version Matrix).
After the update I got following error/information.
Cannot update only a partial set of packages without a lock file present.
Installation failed, reverting ./composer.json to its original content.
As I have no composer.lock in my repository, I tested my pipeline with a composer install first, and then did the update. This is all fine until I go to the next version as the dependencies are different, and the composer.lock from the composer install cannot update the additional dependencies.
I have tried it with composer require --dev nimut/typo3-complete:^10.4 --with-all-dependencies the response from composer:
Problem 1
- typo3/testing-framework is locked to version 4.15.2 and an update of this package was not requested.
- typo3/testing-framework 4.15.2 requires typo3/cms-backend ^9.3 -> found typo3/cms-backend[v9.3.0, ..., 9.5.x-dev] but it conflicts with another require.
Problem 2
- symfony/http-client v5.1.7 requires symfony/http-client-contracts ^2.2 -> found symfony/http-client-contracts[dev-main, dev-master, v2.2.0, v2.3.1, 2.3.x-dev (alias of dev-master)] but it conflicts with another require.
- nunomaduro/phpinsights v1.14.0 requires sensiolabs/security-checker ^6.0 -> satisfiable by sensiolabs/security-checker[v6.0.3].
- sensiolabs/security-checker v6.0.3 requires symfony/http-client ^4.3|^5.0 -> satisfiable by symfony/http-client[v5.1.7].
- nunomaduro/phpinsights is locked to version v1.14.0 and an update of this package was not requested.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
The -W option is the one I'm trying out already. I have tried both -w and -W, no luck so far.
I'm not sure how to get around this problem yet, your input your be very helpful.
Link to .travis.yml
https://github.com/AOEpeople/crawler/blob/master/.travis.yml#L50
Link to Travis Build where testing it out.
https://travis-ci.org/github/AOEpeople/crawler/jobs/738603105#L1138
The issue with composer require was reported and fixed in PR 9336 on Composer's GitHub repository. It will be in Composer 2.0.2 just about to be released now. So you can upgrade to 2.0.2 and it should resolve your problem.
To explain why your workaround failed:
composer require nimut/typo3-complete:$TYPO3_VERSION edits the composer.json file to add "nimut/typo3-complete": "^$TYPO3_VERSION". Then it runs composer update nimut/typo3-complete, or (on Composer 1.x or 2.0.2+) a plain composer update if no lock file exists yet.
If you run a composer install without a lock file first, this executes a composer update because there is no lock file. The subsequent composer require then still edits the json file and now runs composer update nimut/typo3-complete because there is a lock file. Even with all the dependency options enabled, this may have a different outcome or even a conflict from running a plain composer update as you are restricting the update to only the new package and its dependencies.

Categories