samuelvi/spreadsheet-translator-core
Core library for spreadsheet-translator: parses and converts spreadsheet files into translation resources. Built for Laravel/PHP workflows, enabling import/export of i18n strings from Excel/CSV with a clean, reusable engine for other adapters and apps.
Use Case Alignment:
array_unpack improvements) for cleaner data mapping.Laravel Synergy:
Microservice Potential:
Core Features:
array_is_list, str_contains) may simplify transformer logic.Laravel Integration Points:
public function transform(array $data): User).SpreadsheetRule::enum(UserStatus::class)).Dependencies:
symfony/* packages).| Risk Area | Mitigation Strategy |
|---|---|
| PHP 8.4 Breaking Changes | - Test with PHPUnit + pest against PHP 8.4’s strict typing. |
- Use php -l to validate syntax; check for deprecated functions (e.g., create_function). |
|
| Performance Regression | - Benchmark with PHP 8.4’s JIT (if enabled) vs. OPcache. |
| Transformer Refactoring | - Leverage PHP 8.4’s readonly properties for immutable transformers. |
| Dependency Conflicts | - Run composer why-not php:8.4; update spreadsheet-translator-core and PhpSpreadsheet. |
| Testing Gaps | - Add PHP 8.4-specific tests (e.g., TypedProperty support in transformers). |
enum(UserRole::ADMIN))?dom, fileinfo, mbstring remain critical.opcache and jit (PHP 8.4+) may improve transformer performance.| Phase | Action Items |
|---|---|
| Discovery | - Audit transformers for PHP 8.4 compatibility (e.g., array_is_list). |
| - Identify if enums or attributes can replace manual validation. | |
| Pilot | - Upgrade a single transformer to PHP 8.4; test with sample data. |
| - Verify no regressions in parsing/validation. | |
| Integration | - Update composer.json to require PHP 8.4. |
- Add strict typing to new transformer methods (e.g., public function __invoke(array $data): Model). |
|
| Scaling | - Enable PHP JIT in production for performance gains. |
| - Experiment with fibers for async processing (if using Laravel 11+). | |
| Monitoring | - Add PHP 8.4-specific metrics (e.g., JIT success rate) to Telescope. |
PhpSpreadsheet/League/Csv.Carbon for dates).maatwebsite/excel (PHP 8.4 compatible).spatie/array-to-object (if used for dynamic mapping).composer.json:
"require": {
"php": "^8.4",
"samuelvi/spreadsheet-translator-core": "^8.4"
}
composer update --with-all-dependencies.public function transform(array $data): User {
return new User(
readonly id: $data['id'],
name: array_is_list($data['tags']) ? implode(', ', $data['tags']) : $data['tags']
);
}
create_function → closures).public function translate(array $data): array {
return $this->translator->transform($data);
}
@TransformerRule).php.ini:
opcache.jit_buffer_size=100M
opcache.jit=tracing
use Symfony\Component\Fiber\Fiber;
Fiber::create(fn() => $this->processLargeFile($file));
public function testTypedTransformer(): void {
$transformer = new UserTransformer();
$this->assertInstanceOf(User::class, $transformer->transform($data));
}
json_encode flags).match expressions) may need gradual adoption.spreadsheet-translator-core.PhpSpreadsheet (if used)."require": {
"php": "8.4.0",
"samuelvi/spreadsheet-trans
How can I help you explore Laravel packages today?