read-aloud is a WordPress plugin that turns a post into an audio file once, through any text-to-speech API behind a small adapter. Readers see an accessible player only after an editor has listened and approved the file. It synthesises again only when the words that are spoken change. Licence MIT. Version v0.1.0, released 19 November 2026.
It was written from scratch from an idea, as one of the utilities described on the engineering blog. It has not run on a live site, and the PRD says there is no production measurement for it.
Many readers would rather listen to an article than read it. A site that wants to offer that has three poor options.
The failure that matters most is silent spending: the same article is synthesised again and again because something that is not the spoken text changed, such as a tag, a featured image, a relative date or a related-posts box. The second failure is silent wrongness: an article is corrected, but the audio still reads out the old sentence.
audio player with preload="none" and a disclosure line after approval.Hooks on wp_after_insert_post, set_object_terms, trash and untrash call Plugin::defer(). At shutdown each post is triggered once with the strongest reason seen in the request. Planner::plan() returns eligibility, the spoken text and its hash. Unchanged text increments a “saves without resynthesis” counter. Changed text queues a job, on WP-Cron or on a job queue plugin through gen_queue_enqueue_job.
The job reads the kill switch fresh, re-checks eligibility, splits the text at paragraph and sentence ends, and reserves the characters it will send against the daily cap in one atomic database statement through the Ledger. Every response is checked for status, content type, size and magic bytes, so a 200 response holding HTML is a failure, not a file. Chunks are joined and written to a temporary name, then renamed into uploads/read-aloud/. Audio URLs are immutable: a new version always has a new file name. After approval the old file is deleted 48 hours later, because cached pages may still point to it.
A hosted API is configured with a JSON body template, parsed once and filled at the value level, so quotes and backslashes in an article cannot break the request:
{"input": "{text}", "voice": "{voice}", "model": "{model}", "response_format": "{format}", "speed": "{speed}"}
An adapter implements IndianOpinion\ReadAloud\Provider\SpeechProvider. A silent provider makes no network call and costs nothing, for a first try.
READ_ALOUD_DISABLED wins over the setting.http adapter never follows redirects, refuses an endpoint if any of its addresses is private, loopback, link-local or otherwise reserved, and pins the connection to the address it checked.An independent review of the build PR fixed these before the merge.
http adapter’s address check was widened to every A and AAAA address, including link-local and cloud metadata, carrier-grade NAT, IPv6 unique-local and mapped IPv4. The connection is pinned, there are no redirects and the response is limited to 64 MiB.The review also aligned the spend-meter and gen-queue integrations with the released contracts and fixed mp3 duration, which is now summed per frame.
Test status: this is v0.1.0. 131 PHPUnit tests with 1,052 assertions pass, including the ledger tests against a throwaway MySQL 8.0, with PHPStan level 8 and phpcs clean. WordPress and provider calls are tested against stubs and mocks. CI has not yet run on GitHub, and it has no production mileage.
It needs PHP 8.1 or later, WordPress 6.4 or later, outbound HTTPS and a writable uploads directory. The intl extension is recommended.
The package is not on Packagist yet, so first add a Composer vcs repository entry for https://github.com/IndianOpinion/read-aloud.
composer require indianopinion/read-aloud