Where did you define your aliases? If you haven't already, you could start by adding directives for both php and composer in your .bash_profile.
The file should contain something like (alter paths as appropriate):
# Include the location of the PHP 7.4 binary in your path
# Ensure that any calls to composer are run ...
You're probably looking for Element::getDirtyAttributes() and Element::getDirtyFields()!
The former is for native class properties/attributes (and is based on an ActiveRecord pattern in Yii, I believe...), and the latter is for Craft's "fields," which may or may not be available, based on what type of Element you're looking at (and what FieldLayout ...
I assume that $block->tweet->one() returns an Asset element in your matrix block called tweet. I suggest that you use the getContents() method on Craft's Asset element type to retrieve the string content of the actual file. Your code block would look something like this:
$tweetFileContent = $block->tweet->one()->getContents();
It's the __toString() magic method:
The __toString() method allows a class to decide how it will react
when it is treated like a string.