Framework-agnostic PHP library for parsing, reading, and writing text across many file formats.
- PHP 8.3+
- Extensions:
dom,fileinfo,json,mbstring,zip
composer require alirashidnahal/polytextuse 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');| 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 |
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-configcomposer install
composer test
composer analyse
composer formatMIT © Ali Rashidnahal