Releases: farisc0de/PhpFileUploading
v3.2.4
v3.2.3
v3.2.2
v3.2.1
v3.2.0
v3.1.0
v3.0.0
[3.0.0] - 2026-01-10
Major release introducing production-ready features including custom exceptions, PSR-3 logging, event system, storage abstraction, rate limiting, and virus scanning.
Added
Exception Hierarchy
UploadException- Base exception class with context supportValidationException- Validation errors with factory methodsStorageException- Storage operation failuresFileNotFoundException- Missing file errorsConfigurationException- Configuration issuesImageException- Image processing errors
PSR-3 Logging
LoggerInterface- PSR-3 compatible logging interfaceLogLevel- Log level constantsFileLogger- File-based logger with rotation supportNullLogger- No-op logger for testingLoggerAwareTrait- Trait for adding logging to any class
Validation System
ValidationResult- Rich validation result objectsValidationError- Individual error representationValidatorInterface- Validator contractValidationChain- Chain multiple validators togetherExtensionValidator- Extension whitelist/blacklist validationMimeTypeValidator- MIME type validation with strict modeSizeValidator- File size validation with category limitsFilenameValidator- Forbidden names, path traversal detectionImageDimensionValidator- Image dimension and aspect ratio validation
Storage Abstraction
StorageInterface- Flysystem-compatible storage interfaceLocalStorage- Local filesystem storage adapterFileInfo- File/directory metadata representationStorageManager- Multi-disk storage management
Rate Limiting
RateLimiterInterface- Rate limiter contractRateLimitResult- Rate limit check result with headersInMemoryRateLimiter- Memory-based rate limiterFileRateLimiter- Persistent file-based rate limiter
Virus Scanning
VirusScannerInterface- Virus scanner contractScanResult- Scan result representationClamAvScanner- ClamAV integration (socket + CLI)NullScanner- No-op scanner for development
Event System
EventInterface- Event contractAbstractEvent- Base event classUploadEvents- Event name constantsFileEvent- File-related eventsValidationEvent- Validation events with resultScanEvent- Virus scan eventsEventDispatcher- Event dispatcher with prioritiesListenerInterface- Event listener contract
New Classes
UploadManager- All-in-one upload manager combining all featuresUploadResult- Comprehensive upload result object
Testing
- PHPUnit test suite with unit tests for all new components
phpunit.xmlconfiguration file
Changed
Upload Class
- Integrated
LoggerAwareTraitfor PSR-3 logging - Added
EventDispatcherintegration for upload lifecycle events - Replaced generic exceptions with custom exception hierarchy
- Added
enableExceptions()method to throw exceptions instead of returning false - Added
validate()method returningValidationResultobject - Added
setEventDispatcher()andgetEventDispatcher()methods - Added
getFile()andgetFileName()accessor methods - All validation methods now log warnings on failure
- Events dispatched for: before/after upload, before/after validation, validation failed, upload failed
composer.json
- Updated PHP requirement to 8.1+
- Added dev dependencies: phpunit, phpstan, phpcs
- Added autoload-dev for tests namespace
- Added scripts: test, test-coverage, phpstan, cs-check, cs-fix
- Added suggested packages: ext-gd, league/flysystem, monolog
Documentation
- Comprehensive README.md with all new features
- Usage examples for all components
- Security best practices guide
Examples
- Updated
production.phpwith multi-file upload support - Demonstrates all new features: validation chain, rate limiting, virus scanning, events, logging
Dependencies
- Requires PHP 8.1 or higher
- Requires
fileinfoextension - Requires
jsonextension - Optional:
gdextension for image processing
Migration Guide
Users upgrading from 2.x should note:
- Update PHP version to 8.1 or higher
- Exceptions are now specific types - update catch blocks
- Consider using
UploadManagerfor new projects - Enable logging with
setLogger()method - Use
enableExceptions(true)for exception-based flow - Use
validate()method for detailed validation results
v2.6.0
[2.6.0] - 2025-05-03
Enhanced file filtering and validation with a more comprehensive approach to file type management.
Added
- Enhanced filter.json structure with version tracking
- Added categorized MIME types for better file type validation
- Added category-specific file size limits
- Expanded the forbidden files list for improved security
- Added support for more file extensions and MIME types
Changed
- Updated Upload class to use the enhanced filter.json structure
- Improved file category detection based on MIME types
- Enhanced size limit validation with category-specific limits
- Improved MIME type validation with better error handling
- Updated isImage() method to use the new categories structure
v2.5.1
v2.5.0
PhpFileUploading Library 2.5.0 - Release Notes
Overview
We're excited to announce the release of PhpFileUploading v2.5.0, featuring significant enhancements to the core components of the library. This update focuses on improving reliability, security, and performance across all classes, with particular attention to the Image and File classes.
What's New
Image Class Improvements
- Enhanced Resource Management: Implemented try/finally blocks to ensure proper cleanup of image resources in all circumstances
- Better Transparency Handling: Added consistent transparency preservation for PNG images across all manipulation methods
- Improved MIME Type Detection: Created a robust fallback system for determining image types when standard PHP functions are unavailable
- Memory Optimization: Added temporary memory limit adjustments for processing large images
- GD Extension Validation: Added explicit checks for GD library availability to prevent cryptic errors
- Better Error Handling: More specific error messages and improved exception handling
File Class Enhancements
- Robust File Validation: Improved validation of uploaded file arrays with more specific type checking
- Enhanced MIME Type Detection: Implemented a multi-layered approach with fallbacks for reliable MIME type identification
- Memory-Efficient File Hashing: Added streaming approach for hashing large files (>10MB) to prevent memory issues
- Improved Empty File Detection: Enhanced detection of empty uploads with multiple condition checks
- File Integrity Verification: Added size consistency checks between reported and actual file sizes
- Better Error Handling: More specific error messages and improved exception handling
General Improvements
- Code Quality: Enhanced code structure and readability across all classes
- Error Handling: More consistent and informative error messages
- Security: Improved validation and sanitization of inputs
- Performance: Optimized resource usage for better performance with large files
Breaking Changes
- The
Imageclass now throws an exception if the GD extension is not available - The
File::isEmpty()method now uses stricter criteria to determine if a file is empty - Error handling is more strict, with exceptions thrown earlier in the process
Upgrade Instructions
This release maintains backward compatibility with existing code that follows best practices. However, if your code relies on specific error handling behaviors or makes assumptions about resource management, we recommend testing thoroughly before upgrading in production.
Future Plans
In upcoming releases, we plan to introduce additional features to the Image class including:
- Image cropping functionality
- Image rotation and flipping
- Thumbnail generation
- EXIF data handling
- Advanced watermarking options