Error "Class Swift_keycache_simplekeycacheinputstream does not exist"

Asked

Viewed 93 times

1

I’m trying to email with Laravel 5.1, but I always get the message below.

Reflectionexception in Dependencycontainer.php line 309: Class Swift_keycache_simplekeycacheinputstream does not exist

My file Composer.json is as follows:

{
  "name": "laravel/laravel",
  "description": "The Laravel Framework.",
  "keywords": ["framework", "laravel"],
  "license": "MIT",
  "type": "project",
  "require": {
      "php": ">=5.5.9",
      "laravel/framework": "5.1.*",
      "swiftmailer/swiftmailer": "@stable"
  },
  "require-dev": {
      "fzaninotto/faker": "~1.4",
      "mockery/mockery": "0.9.*",
      "phpunit/phpunit": "~4.0",
      "phpspec/phpspec": "~2.1",
      "guzzlehttp/guzzle": "~5.3|~6.0"
  },
  "autoload": {
      "classmap": [
          "database"
      ],
      "psr-4": {
          "App\\": "app/"
      }
  },
  "autoload-dev": {
      "classmap": [
          "tests/TestCase.php"
      ]
  },
  "scripts": {
      "post-install-cmd": [
          "php artisan clear-compiled",
          "php artisan optimize"
      ],
      "pre-update-cmd": [
          "php artisan clear-compiled"
      ],
      "post-update-cmd": [
          "php artisan optimize"
      ],
      "post-root-package-install": [
          "php -r \"copy('.env.example', '.env');\""
      ],
      "post-create-project-cmd": [
          "php artisan key:generate"
      ]
  },
  "config": {
      "preferred-install": "dist"
  }
  }
  • Use the title always on the code problem to facilitate, "send email" is just the desired result friend. I edited the title.

3 answers

0


I solved my problem with the following way: I searched the classes that were missing in my project in the folder vendor and found that they were a blank php file, so I downloaded the Swiftmailer project into Github and copied the missing classes and the system worked perfectly.

  • You probably forgot to add the dependencies to Composer and this caused such files not to be downloaded (I’m not sure, I’m not familiar with Composer)

0

You probably forgot some addiction, I don’t know for sure.

If there is no Composer.lock file, then Composer will read your dependencies and versions that are in Composer.json and will create the crash file (Composer.lock) after executing the command update or install.

After you edit your Composer.json run this command:

php composer.phar update

Note: Composer will display an alert when executing a random installation command composer.lock and composer.json are not synchronized.

If you want to update only one dependency, you can try the following command:

php composer.phar update swiftmailer/swiftmailer @stable
  • I had done it before, and yet this empty class came. This I did was the only solution I could find.

  • @Pedrosoares Composer.json and lock were synchronized? Tried install command first?

  • Yes, it was with the install that he downloaded the swiftmailer.

  • 1

    @Pedrosoares then may be a problem in the repository, it creates an Issue there, I will follow: https://github.com/swiftmailer/swiftmailer/issues/new

  • I’ve done the Issue there.

  • 1

    @Pedrosoares Legal, I hope it’s a bug and can be fixed soon, doing manual dependency update is very complicated :)

Show 1 more comment

0

Log in mail.php in app/config/.

You filled in the email submission information in this file ?

'driver' => 'smtp',
'host' => 'smtp.one2up.com.br',
'port' => 587,
'from' => array('address' => '', 'name' => ''),
'encryption' => '',
'username' => '',
'password' => '',
  • Yes, my version is in /config/mail.php, not in the app folder. Other than that, I made all the settings.

  • Change smtp for mail, then and see if the error persists.

  • I switched and the same mistake persists.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.