The case · ThinkPHP 8
Tangshan Lawyers Association
The original is plain PHP (GBK, native templates and PDO). The demo is ThinkPHP 8 (routing, controllers, ORM, middleware). Same layout, same URL shapes, same back office — zero downtime, no data loss.
What was rebuilt
The original site is plain PHP — GBK encoded, native templates, PDO straight to SQLite. Content, sections, firms, lawyers and every extended field were moved into a ThinkPHP 8 application, with the original templates kept in place so the front end stays identical.
Constraints
- The production site had to stay online and untouched during the whole rebuild.
- URL shapes had to keep working — including pagination and search parameters.
- The back office had to behave the same: same list size, same filters, same edit forms.
Verification
Both sites were crawled and compared page by page: DOM node counts, text blocks and titles. 3,183 pages, zero differences.
Original vs demo
Original · plain PHP
- Native PHP templates with queries inline
- PDO straight to SQLite, SQL scattered in pages
- Hand-written single entry and regex rewrites
- Auth checks repeated at the top of every file
Demo · ThinkPHP 8
- Declarative routes and controller dispatch
- think-orm models and query builder, views free of SQL
- Controller middleware for auth, validators for input
- Templates stay plain PHP — on purpose, to match 1:1
Stack
| PHP 8.5 | plain PHP templates with framework layering |
|---|---|
| ThinkPHP 8 | routing, controllers, ORM, middleware, validators |
| SQLite / MySQL | SQLite by default for single-server sites, MySQL when needed |
| Nginx + PHP-FPM | dedicated pool, long cache for assets, none for HTML |
Open the demo ↗
The demo database is physically separate; the production site stayed read-only.