Download the PHP package cmatosbc/penelope without Composer
On this page you can find all versions of the php package cmatosbc/penelope. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cmatosbc/penelope
More information about cmatosbc/penelope
Files in cmatosbc/penelope
Package penelope
Short Description Tentative implementation of asynchronous file handling for PHP.
License gpl-3.0-or-later
Informations about the package penelope
Penelope ๐งต
A high-performance asynchronous file handling library for PHP, leveraging Fibers for non-blocking I/O operations.
๐ Overview
Penelope is designed to handle large file operations efficiently by utilizing PHP's Fiber feature for asynchronous processing. It breaks down file operations into manageable chunks, allowing for better memory management and improved performance, especially for large files.
Why Penelope?
- Memory Efficient: Process large files without loading them entirely into memory
- Non-Blocking: Leverage PHP Fibers for asynchronous operations
- Flexible: Support for both synchronous and asynchronous operations
- Transformable: Apply custom transformations during read/write operations
- Progress Tracking: Monitor write progress in real-time
- Compression Support: Built-in support for gzip, bzip2, and deflate compression
- Error Resilience: Robust error handling with retry mechanisms and logging
๐ Requirements
- PHP 8.1 or higher (Fiber support required)
- Composer for dependency management
- PHP Extensions:
zlib
for gzip/deflate compressionbz2
for bzip2 compression (optional)
๐ Installation
๐ Usage
Basic File Reading
Compression Support
Error Handling with Retries
Combining Features
๐ฏ Use Cases
1. Large File Processing
Perfect for processing large log files, data exports, or any situation where memory efficiency is crucial:
2. File Compression and Archiving
- Compress large log files for archival
- Create compressed backups of data files
- Stream compressed data to remote storage
- Process and compress multiple files in parallel
3. Error-Resilient Operations
- Retry failed network file transfers
- Handle intermittent I/O errors gracefully
- Log detailed error information for debugging
- Implement progressive backoff for rate-limited operations
๐ Performance
Based on our benchmarks with a 100MB file:
- Async Read: ~3.4x faster than synchronous read
- Async Write: Comparable to synchronous write
- Memory Usage: Consistent across operations
- Chunk Size: Default 8KB (configurable)
๐งช Testing
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details. This means:
- You can freely use, modify, and distribute this software
- If you modify and distribute this software, you must:
- Make your modifications available under GPL-3.0
- Include the original copyright notice
- Include the full text of the GPL-3.0 license
- Make your source code available
โ ๏ธ Important Notes
- Requires PHP 8.1+ for Fiber support
- Performance may vary based on file size and system configuration
- For optimal performance, adjust chunk size based on your use case
๐ Links
- PHP Fibers Documentation
- Issue Tracker
- Contributing Guidelines