alirashidnahal / polytext
Framework-agnostic PHP library for parsing, reading, and writing text across many file formats.
v1.0.0
2026-07-10 20:40 UTC
Requires
- php: ^8.3
- ext-dom: *
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- ext-zip: *
- dompdf/dompdf: ^3.1
- league/csv: ^9.22
- phpoffice/phppresentation: ^1.1
- phpoffice/phpspreadsheet: ^4.0
- phpoffice/phpword: ^1.3
- smalot/pdfparser: ^2.11
- symfony/yaml: ^7.2|^8.0
Requires (Dev)
- illuminate/support: ^13.0
- laravel/pint: ^1.29
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^12.0
Suggests
- illuminate/support: Required for the optional Laravel bridge (^13.0).
This package is auto-updated.
Last update: 2026-07-10 20:44:01 UTC
README
Framework-agnostic PHP library for parsing, reading, and writing text across many file formats.
Requirements
- PHP 8.3+
- Extensions:
dom,fileinfo,json,mbstring,zip
Installation
composer require alirashidnahal/polytext
Quick Start
use Alirashidnahal\Polytext\Polytext; $polytext = new Polytext(); $document = $polytext->open('report.docx'); foreach ($document->nodes() as $node) { $node->setText(strtoupper($node->text())); } $document->save('report-modified.docx');
Supported Formats
| Category | Extensions |
|---|---|
| Text | txt, text, log, md, markdown |
| Subtitles | srt, vtt, ass, ssa, sub |
| Web | html, htm, xml |
| Data | json, csv, yaml, yml |
| Office | docx, odt, rtf, xlsx, xls, ods, pptx, ppt |
Laravel
Auto-discovery registers PolytextServiceProvider and the Polytext facade.
use Alirashidnahal\Polytext\Laravel\Facades\Polytext; $document = Polytext::open(storage_path('app/file.docx'));
Publish config:
php artisan vendor:publish --tag=polytext-config
Development
composer install
composer test
composer analyse
composer format
License
MIT © Ali Rashidnahal