covex-nn/joos-stream
JooS_Stream provides a PHP stream wrapper for a virtual filesystem protocol mapped to a base directory. Register a custom scheme, then use standard functions like file_put_contents, unlink, and file_exists on scheme:// paths; unregister when done.
Storage facade, FilesystemManager) but operates at a lower level (stream wrapper vs. filesystem adapter).file driver) or queue workers (e.g., storing job payloads temporarily).stream_wrapper_register() API, so no Laravel-specific dependencies exist. However:
Filesystem contract, so it won’t replace Storage::disk() directly. Would need a custom adapter to bridge the gap.commit()) is a manual opt-in—no ACID guarantees or rollback mechanisms. Useful for simple atomicity but not for complex workflows.commit() and error handling is undocumented.Storage facade (e.g., transactional writes)?commit() be triggered? Manually per operation or via Laravel events (e.g., filesystem.writing)?Storage::fake() for unit tests? If so, how will test assertions adapt?zip, s3).register() to scope it to Laravel’s lifecycle.joos_stream config section for protocol naming and transaction behavior.JooSStorage class extending Laravel’s Filesystem to wrap the stream API.commit() to Laravel events (e.g., filesystem.written) for automatic persistence.storage_path('temp') with joos://temp for ephemeral files.JooSFilesystem class implementing Laravel’s Filesystem interface:
class JooSFilesystem implements Filesystem {
public function write($path, $contents, $options = []) {
file_put_contents("joos://$path", $contents);
// Trigger commit on demand or via event
}
// ... other methods
}
config/filesystems.php:
'joos' => [
'driver' => 'joos',
'protocol' => 'joos',
'root' => storage_path('joos'), // Optional: real FS fallback
],
Storage::fake() with Storage::disk('joos') in tests.JooS\Stream\Wrapper_FS::commit().Filesystem interface.file_put_contents() directly (e.g., Intervention/Image) won’t auto-detect the wrapper.joos://path/to/file (not storage:app/file).joos:// for transactions, fall back to real FS for non-critical ops.JooSFilesystem adapter and add it to filesystems.php.file_put_contents()) with Storage::disk('joos').job.processed event).joos:// where transactions are needed.Filesystem interface.joos:// vs. real storage.commit().joos:// operations (e.g., file_put_contents calls).FilesystemManager::firstAvailable() to retry with a secondary disk.realpath_cache_size tuning or limit file sizes.joos:// instances per process/queue worker.commitToDisk() method to sync to real storage periodically.| Scenario | Impact | Mitigation |
|---|---|---|
| PHP Crash | Uncommitted transactions lost | Implement auto-commit on shutdown. |
| Memory Exhaustion | Stream wrapper fails | Set memory limits per request. |
| Path Traversal | Security vulnerability | Validate all joos:// paths. |
| Laravel Cache Invalidation | Stale data if using file driver |
Exclude joos:// from cache. |
| Package Abandonment | No future fixes | Fork and maintain internally. |
Storage::disk('joos')).How can I help you explore Laravel packages today?