I'm in the process of upgrading our Laravel 5.1 app to Laravel 5.5, and have been following the upgrade guides.
Whilst performing the upgrade from 5.3 to 5.4, I've run into an issue with failing unit tests that use MailThief's InteractsWithMail trait.
composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7",
"laravel/framework": "5.4.*",
"laravelcollective/html": "5.4.*",
"jeremykendall/php-domain-parser": "^3.0",
"laracasts/flash": "^2.0",
"aws/aws-sdk-php": "^3.21",
"league/flysystem-aws-s3-v3": "~1.0",
"maatwebsite/excel": "^2.1",
"league/oauth2-client": "1.4.*",
"microsoft/microsoft-graph": "^0.1.1",
"guzzlehttp/guzzle": "^6.2",
"dusterio/laravel-aws-worker": "^0.1.9",
"zizaco/entrust": "5.2.x-dev",
"anchu/ftp": "^2.0",
"predis/predis": "~1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6",
"phpspec/phpspec": "~2.1",
"laravel/homestead": "^4.0",
"tightenco/mailthief": ">=0.3.8",
"barryvdh/laravel-ide-helper": "*",
"doctrine/dbal": "^2.5",
"symfony/dom-crawler": "~3.1",
"symfony/css-selector": "~3.1",
"laravel/browser-kit-testing": "^2.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Support/Helpers.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
],
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate -M",
"php artisan ide-helper:meta",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
Unit test stack trace:
Target [Illuminate\Contracts\View\Factory] is not instantiable while building [MailThief\MailThiefFiveFourCompatible].
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:895
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:735
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:608
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:575
/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:728
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:862
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:790
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:756
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:608
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:575
/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:728
/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:1172
/app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:159
/app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:128
/app/vendor/tightenco/mailthief/src/Testing/InteractsWithMail.php:21
/app/vendor/tightenco/mailthief/src/Testing/InteractsWithMail.php:59
I'm using Homestead hosted on Windows 10.
Related
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"MatthiasMullie/Minify": "^1.3",
"guzzlehttp/psr7": "^1.0",
"intervention/image": "^2.3",
"kbsali/redmine-api": "^1.5",
"kordy/ticketit": "^0.3.6",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravelcollective/html": "5.*",
"maatwebsite/excel": "~2.1.0",
"maddhatter/laravel-fullcalendar": "1.*",
"milon/barcode": "^5.0",
"psr/http-message": "^1.0",
"unisharp/laravel-filemanager": "^1.7"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7",
"jamesiarmes/php-ntlm": "dev-master",
"php-ews/php-ews": "dev-master"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
I don't know how to use twbs in my Laravel project. So how can I delete this folder?
composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"twbs/bootstrap": "4.0.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
The good idea is to use composer remove command without updating all other packages:
composer remove twbs/bootstrap
Remove "twbs/bootstrap": "4.0.0" line from composer.json and then run command:
composer update
Run This command For Remove any package
composer remove twbs/bootstrap
I'm currently creating a website with Symfony3.2.4, I've installed Sonata News Bundle on my website.
I'm trying to having an access to my website but Symfony show me an error.
Type error: Return value of Sonata\UserBundle\SonataUserBundle::registerFormMapping() must be an instance of Sonata\UserBundle\void, none returned
I don't know from where this error is coming for and how to fix it...
Here is my composer.json :
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle",
"Application\\": "src/Application"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/"
},
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
},
"require": {
"php": ">=5.6",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"sonata-project/admin-bundle": "^3.23",
"sonata-project/doctrine-orm-admin-bundle": "^3.1",
"sonata-project/news-bundle": "^3.1",
"sonata-project/user-bundle": "^3.3",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"preferred-install": "dist",
"platform": {
"php": "5.5.9"
},
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.4-dev"
}
}
}
I've got no idea from where this coming this error and hox to fix it.
That's why I request your help ^^.
Thanks a lot.
I had the same problem with my app. It turned out I was using PHP 7.0 and void is a feature introduced in PHP 7.1 (http://php.net/releases/7_1_0.php).
Please double check you are using PHP 7.1+.
I forked this bundle "[egeloen/ivory-google-map][1]"
[1]: https://github.com/egeloen/ivory-google-map/ to this [repository][1]
[1]: https://github.com/spinoza123/ivory-google-map and i changed the original url in composer.json to my forked repository, but when i do composer update i have this error
[InvalidArgumentException]
Could not find a matching version of package spinoza123/google-map. Check the package spelling, your version constr
aint and that the package is available in a stability which matches your minimum-stability (stable).
Must i publish it in pakagist, if yes is it free and how to do that ?
my composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" },
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
}
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"twig/twig": "^1.0||^2.0",
"spinoza123/ivory-google-map": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"platform": {
"php": "5.5.9"
},
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.4-dev"
}
}
}
Thanks
Use VCS in your composer.json
There are a few use cases for this. The most common one is maintaining your own fork of a third party library. If you are using a certain library for your project and you decide to change something in the library, you will want your project to use the patched version. If the library is on GitHub (this is the case most of the time), you can simply fork it there and push your changes to your fork.
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/spinoza123/ivory-google-map"
}
],
"require": {
"egeloen/ivory-google-map": "dev-master"
}
}
I recently made a composer update on my Symfony app (2.7). Since I did this update, swiftmailer went from 2.4 to 2.5 and after the command, the console displayed me this error:
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail".
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "mail".
I tried to remove the swiftmailer directory in "vendor", but it didnt work.
Here's my composer.json:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" }
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "7.0"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.7-dev"
}
}
}
Thank you in advance for your help.
This has definitely been happening since today. (I'm on Symfony 2.8.17.) Reverting the Swiftmailer bundle back to version 2.4 fixed this for me.
In your composer.json file change
"symfony/swiftmailer-bundle": "~2.3",
to
"symfony/swiftmailer-bundle": "2.4",
Now do a composer update so you go back to version 2.4 of the Swiftmailer bundle and all should be well. Looks like there is a bug in the 2.5 update.
--
If you're still having problems try these commands to fully flush out cache:
rm -rf app/cache/*
rm app/bootstrap.php.cache
Also check your composer.lock file to ensure that the Swiftmailer bundle really has reverted back to 2.4. You should see a section like this:
{
"name": "symfony/swiftmailer-bundle",
"version": "v2.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/swiftmailer-bundle.git",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/ad751095576ce0c12a284e30e3fff80c91f27225",
"reference": "ad751095576ce0c12a284e30e3fff80c91f27225",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"swiftmailer/swiftmailer": ">=4.2.0,~5.0",
"symfony/config": "~2.7|~3.0",
"symfony/dependency-injection": "~2.7|~3.0",
"symfony/http-kernel": "~2.7|~3.0"
},
"require-dev": {
"symfony/console": "~2.7|~3.0",
"symfony/framework-bundle": "~2.7|~3.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
"symfony/yaml": "~2.7|~3.0"
},
"suggest": {
"psr/log": "Allows logging"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Bundle\\SwiftmailerBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien#symfony.com"
}
],
"description": "Symfony SwiftmailerBundle",
"homepage": "http://symfony.com",
"time": "2016-12-20T04:44:33+00:00"
},
Most likely the issue you're describing was not caused by a bug, but by changed related dependency to swiftmailer/swiftmailer.
You have requested a non-existent service "mail". says that a service mail is missing, Unable to replace alias "swiftmailer.mailer.default.transport.real" with actual definition "mail". is a broad hint that this is related to swfitmailer transport mail, the class Swift_Transport_MailTransport using insecure php mail() function. This transport is deprecated since
swiftmailer version 5.4.5 for security reasons.
In order to fix the issue, you need to
switch from transport mail to a transport supported by current swiftmailer, or
add "swiftmailer/swiftmailer": "<6.0" to your composer.json dependencies in order to prevent packages from installing swiftmailer v6.x where Swift_Transport_MailTransport is gone. Unfortunately, symfony/swiftmailer-bundle requires swiftmailer v6.x starting from v3.0.0, so you would need to require "symfony/swiftmailer-bundle": "^2"