Automatic Web Page Optimisation in Pure PHP
summary
A PHP library called Phast parses HTML on the fly (via output buffering and a tokenizer), inlines critical CSS inlining, proxies and WebP-converts images, and loads scripts by Ajax+eval while masking readyState and document.write so legacy WordPress sites render earlier. Installation is composer-based and a WordPress plugin has ~800 users. Server-side processing adds about 60–80ms overhead but yields a much faster first render and reduced bandwidth on repeat views.
AI-written summary · about
chapters (12)
- 0:00Start
- 2:11A familiar story...
- 2:4553% will leave a page if it takes 3 s to load
- 5:17Google grades my site badly!
- 8:01Latency Bandwidth Roundtrips
- 17:30Remove render- blocking CSS & JS
- 18:59EAT SLEEP OPTIMIZE REPEAT
- 26:51Inlining critical CSS
- 29:43Inline scripts Events document.write
- 35:31Very fast first render PageSpeed score Bandwidth savings
- 36:30Increased TTFB Difficult debugging Doesn't work for SPA
- 38:39mod_pagespeed








