chigix/io-component
Java-like IO utilities for PHP: base InputStream/OutputStream classes, stdin/stdout helpers, serialization and filesystem stream support. Create custom streams by extending base classes and plug them into file, console, or network IO workflows.
java.io-style abstractions clash with Laravel’s modern PHP ecosystem (e.g., no integration with Laravel’s Storage, Filesystem, or Events). The stream model is redundant given Laravel’s built-in solutions (e.g., SplFileObject, Symfony\Component\Filesystem).java.io-like patterns are enforced.InputStream, OutputStream) allow custom stream creation, this requires reinventing Laravel-compatible wrappers (e.g., service providers, Facades), adding complexity.Illuminate/Contracts compatibility).__get(), __set()) or PHP 8.x features (e.g., named arguments).Mockery integrations).create_function, magic methods) and strict typing.Illuminate\Filesystem\Filesystem).file_get_contents vs. FileInputStream).ReactPHP or Amp), limiting scalability for high-throughput tasks.java.io-style patterns (e.g., for Java-PHP hybrid teams), or are Laravel/Symfony alternatives sufficient?Storage or Symfony\Component\Filesystem without breaking changes?Symfony\Component\Filesystem, Laravel Filesystem, or ReactPHP for the target use case?SplFileObject) be more maintainable?Storage, Events, or Queue systems.StdInputStream::getInstance()), conflicting with Laravel’s dependency injection.Symfony\Component\Filesystem for filesystem operations.ReactPHP or Amp for async streams.Storage facade for file I/O.fopen, file_get_contents, custom stream logic).$this->app->bind('custom.stream', function () {
return new \Chigi\Component\IO\FileOutputStream(storage_path('logs/custom.log'));
});
IO::readLine()).Symfony\Component\Filesystem or SplFileObject.composer.json platform config to enforce PHP 7.4:
"config": {
"platform": {
"php": "7.4"
}
}
create_function with closures).Illuminate\Support\Traits\Macroable may clash with the package’s magic methods.ArrayAccess, Countable, or Serializable interfaces.__get, __set, __call).composer create-project --prefer-dist laravel/laravel:^8.0 sandbox
cd sandbox
composer require chigix/io-component
StdInputStream, FileOutputStream).// app/Providers/IOServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class IOServiceProvider extends ServiceProvider {
public function register() {
$this->app->singleton('io.input', function () {
return \Chigi\Component\IO\StdInputStream::getInstance();
});
}
}
Storage::disk()->read() vs. FileInputStream).Symfony\Component\Filesystem.// Before (chigix/io-component)
$stream = new \Chigi\Component\IO\FileInputStream('file.log');
while (($line = $stream->readLine()) !== null) {
// ...
}
// After (Symfony Filesystem)
$file = new \Symfony\Component\Filesystem\Filesystem();
$lines = file('file.log', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
How can I help you explore Laravel packages today?