zendframework/zend-mime
Zend\Mime is a PHP library for creating and parsing MIME messages. Build multipart emails, manage MIME parts, boundaries, headers, and content types/encodings, and handle attachments reliably—useful for mail composition and transport integration.
Start by requiring the package via Composer (composer require zendframework/zend-mime). Despite being archived and last released in 2019, it remains compatible with modern PHP versions (5.6–8.0+) due to minimal dependencies and strict standards compliance. The primary use case is building and parsing MIME multipart messages—common in email generation (e.g., HTML + text + attachments). Begin with Zend\Mime\Mime and Zend\Mime\Message classes. For basic email sending, pair it with zendframework/zend-mail (which internally depends on this package). If using standalone, instantiate Zend\Mime\Message, set body parts via Zend\Mime\Part, and call $message->generateMessage() to output the raw MIME string.
addPart() with Zend\Mime\Part instances—set type, encoding, filename, and content for each (e.g., text/plain, text/html, application/pdf).Zend\Mime\Part with isNewLine() to manage line endings correctly and setEncoding(Mime::ENCODING_BASE64) for binary files.Mime::LINE_LENGTH constants (LONG, SHORT) to ensure RFC-compliant line wrapping.zend-mail, you can generate MIME strings via Zend\Mime\Message and inject them as raw bodies into other mail libraries.Zend\Mime\Mime to assert generated message structure without relying on external mail servers.\r\n; use Zend\Mime::setLineEndings("\n") for Unix environments to avoid SMTP quirks (especially with sendmail).Zend\Mime::ENCODING_BASE64 and charset=UTF-8 in typeParams. Failure here causes broken filenames in some clients (e.g., Outlook). laminas/laminas-mime (the official successor fork) for active support—zendframework/zend-mime is deprecated but functionally stable for legacy/conservative projects.Zend\Mime\Part with setFile() and setDiskFile() (via laminas/laminas-mime extension).var_dump($message->generateMessage()) and validate using tools like MIME Validator or spamassassin --lint.How can I help you explore Laravel packages today?