Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jimb814's avatar

Error Class 'Swift_StreamFilters_StringReplacementFilter' not found

I am new to Laravel.

I have encountered a dead-end. I posted the question on StackOverflow, and hopefully it's okay to post the link here in the hope that someone in the Laravel community might have a remedy.

Code that works fine on my machine using Mailtrap fails on InMotion Hosting's server. Something is wrong, I believe with my mail configurations, but at the same time they appear correct.

I was unable to find any solutions online and only one link of the same issue. It was posted but there were no replies. Any help is greatly appreciated.

https://stackoverflow.com/questions/65025862/laravel-mail-error-class-swift-streamfilters-stringreplacementfilter-not-foun

0 likes
15 replies
jlrdw's avatar

I'd try sending an email with just php email, That might help determine if it's the host or something else.

Also make a support ticket, and check Swift Github for issues.

Many times there are work a rounds in the issue replies.

Naturally double check your settings.

jimb814's avatar

Thanks jlrdw. I was able to send an email using php mail(). Perhaps that rules out the host server as the problem. I opened an issue on Github: https://github.com/swiftmailer/swiftmailer/issues/1306

The mail settings appear correct:

MAIL_MAILER=smtp MAIL_HOST=secure279.inmotionhosting.com MAIL_PORT=465 MAIL_USERNAME=full_email_address MAIL_PASSWORD=password MAIL_ENCRYPTION=SSL MAIL_FROM_ADDRESS=full_email_address

This error was reported on laravel.io two years ago without a reply. https://laravel.io/forum/class-swift-streamfilters-stringreplacementfilter

Snapey's avatar

I don't think its an issue with your code.

How did you install the application on the production server? Definitely worth running composer dump on the server if you have ssh access. If you install on the server, delete the vendor folder and run composer install

jimb814's avatar

Thanks Snapey. The code was deployed to InMotion Hosting via FTP. It's a shared server account. I do not believe that I have access to a CLI in a shared server account. I do suspect that it's possible that something went wrong uploading 27,000 files because during debugging I found two files that were empty. It's my understanding that only a dedicated server account (expensive) has use of the CLI. Is that correct?

Snapey's avatar
Snapey
Best Answer
Level 122

a vps can be had from as little as $5 per month, but anyway;

Before you FTP the site, I would

  • run composer dump
  • clear cached views php artisan view:clear
  • cache the config php artisan config:cache
  • cache the routes php artisan route:cache

you really need to think about how you deploy projects though because FTPing the site is laborious and error prone. It won't give you confidence to push changes each time you make them.

jimb814's avatar

I am wide open to better ways to do anything, so please share your deployment suggestions.

Stphn's avatar

A 'best practice' on deployment with Laravel is Laravel Forge (https://forge.laravel.com). You can easily connect your repository (github/bitbucket/etc) to a host on a VPS (that are provisioned by Forge aswell). It'll cost you maybe a bit more than your plain old webhosting provider, but it saves you hours of work on uploading files and debugging your project.

MarianoMoreyra's avatar

Hi @jimb814

From Inmotion page (https://www.inmotionhosting.com/shared-hosting)

Features include cPanel, FTP/SSH access, Softaculous application installer, and email creation and management.

So you should be able to connect via ssh to your server and then run the suggested commands to correctly deploy your application.

You'll probably have to enable and configure your ssh access from the cPanel (that it's included according to the shared-hosting specifications mentioned above)

jimb814's avatar

Thanks. Forge looks interesting. Do you know whether with Forge you can use the CLI?

Stphn's avatar

Yes. You own the server. You'll get a ssh login to work with the terminal.

jimb814's avatar

File errors occurred during FTP upload to host server. Ran those commands and re-uploaded using FileZilla and over-writing files where the target already existed (several target files were empty). Code now works as expected. Thanks!

jimb814's avatar

Thanks Bahyusanciko. The store function works except the Mail part, so it appears that my Internet connection is intact.

jlrdw's avatar

@jimb814 just a thought, are you using the latest version of swift.. that works with your version of laravel.

Please or to participate in this conversation.