Encryption/decryption of a string with a salt
Salt

Your salt isn't a salt, it's a key.

And you are generating a random key if none is given, and the user has no acces to this key. This means that if I do this:

$encryptedPassword = $safePassword-&gt;encryptString($passwordBefore);
$decryptedPassword = $decrypt-&gt;decryptString($encryptedPassword);


My output will be:

Current Password: TestPassword
Encrypted: ZWZNn1FC8F0NCO7Ac7YZojlUITPupOXsDV3BLvS3W2M=
Decrypted: æÁSLkz-HGÐyV]l¥S3]‹*õA"VÚX'


This shouldn't happen.

I would remove the generation code in encryptString and rename salt to key.

Hashing vs Encryption

Generally, passwords are not encrypted, they are hashed. Is there a reason you are encrypting your passwords?

Padding oracle attacks

You are vulnerable to padding oracle attacks. I linked to some resources about this in this post.

Object creation

Why are you creating two stringEncryption objects? One would be enough.

Style


be consistent: either curly brackets go on the same line or the next
follow conventions: class names start with an uppercase letter


If you want to learn more about OOP in PHP, I would suggest you write something where your objects have a state (for example Conway's Game of Life).