Error "Class Swift_KeyCache_SimpleKeyCacheInputStream does not exist"

1

I'm trying to send email with Laravel 5.1, but I get the message below every time.

  

ReflectionException in DependencyContainer.php line 309:   Class Swift_KeyCache_SimpleKeyCacheInputStream does not exist

My composer.json file looks like this:

{
  "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"
  }
  }
    
asked by anonymous 23.09.2015 / 16:29

3 answers

0

I solved my problem in the following way: I looked for the classes that were missing from my project in the vendor folder and found that they were a blank php file, so I downloaded the GitHub project SwiftMailer and copied the missing classes and the system worked perfectly.

    
24.09.2015 / 04:23
0

Enter the file mail.php into app/config/ .

Have you filled out the email sending information in this file?

'driver' => 'smtp',
'host' => 'smtp.one2up.com.br',
'port' => 587,
'from' => array('address' => '', 'name' => ''),
'encryption' => '',
'username' => '',
'password' => '',
    
23.09.2015 / 16:40
0

You've probably forgotten some dependency, I'm not sure.

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

After you edit your composer.json, run this command:

php composer.phar update
  

Note: The Composer will display an alert when executing an installation command, otherwise 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
    
24.09.2015 / 04:49