Skip to content

Conversation

@october-moon
Copy link

📝 Summary

Remove the external laminas/laminas-mime dependency and replace it with a custom HeaderFieldParser utility class to reduce external dependencies while maintaining full compatibility with existing functionality.

🔄 Changes

  • Remove dependency: Remove laminas/laminas-mime from composer.json
  • New utility class: Add Hyperf\HttpMessage\Util\HeaderFieldParser with comprehensive header parsing capabilities
  • Core functionality: Implement splitHeaderField() method to replace Decode::splitHeaderField from laminas-mime
  • Convenience method: Add splitContentType() for easy Content-Type header parsing
  • Integration: Update MessageTrait to use the new parser
  • Test coverage: Add comprehensive unit tests covering various parsing scenarios including quoted values, case-insensitive parameters, multipart boundaries, and Content-Disposition headers

✨ Benefits

  • ✅ Reduced external dependencies
  • ✅ Better performance (no external library overhead)
  • ✅ Full backward compatibility
  • ✅ Comprehensive test coverage
  • ✅ Case-insensitive parameter support
  • ✅ Support for quoted values and multipart boundaries

🧪 Testing

Added comprehensive unit tests to ensure all parsing scenarios work correctly, including edge cases with quoted values, different parameter formats, and various header types.

📋 Checklist

  • Code follows project style guidelines
  • Self-review of the code
  • Code has been tested locally
  • Added unit tests for new functionality
  • Documentation updated if necessary

…oser.json 中的 laminas/laminas-mime 依赖

- 新增 Hyperf\HttpMessage\Util\HeaderFieldParser 工具类- 实现 splitHeaderField 方法替代原有的 Decode::splitHeaderField
- 添加 splitContentType 便捷方法用于解析 Content-Type 头部
- 在 MessageTrait 中使用新的 HeaderFieldParser 类
- 添加完整的单元测试覆盖各种解析场景
- 支持解析带引号的值和大小写不敏感的参数名
- 提供对 multipart 边界和 Content-Disposition 头部的解析支持
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Hi, this is a READ-ONLY repository, please submit your PR on the https://github.com/hyperf/hyperf repository.

This Pull Request will close automatically.

Thanks!

@github-actions github-actions bot closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants