What’s New in ThinkPHP 8.1? Key Routing, Logging, and Optimization Updates
The ThinkPHP 8.1 release introduces sub‑directory route grouping, version checking, enhanced logging, ORM compatibility, and several command‑line optimizations, while removing obsolete exceptions and improving middleware handling, providing developers with clearer routing control and more reliable log management.
Main Updates
Major additions include sub‑directory route grouping, route version checking, and optimized log writing.
Removed ClassNotFoundException from core; use exception classes from think-container directly.
Improved support for MISS routes in grouped bindings.
Route URLs no longer support direct access. ModelService now compatible with ORM 4.0.
Enhanced CallbackDispatch handling.
Added header request filtering detection method ( header).
Added version method for version control checks.
Improved withoutmiddleware support for automatic layer middleware.
Log writing now respects the record timestamp; LogRecord now includes time info.
Enabled forced routing to block direct URL access.
Route definitions now support sub‑directory groups with automatic scanning registration.
Improved Route class group method usage.
Enhanced Route name generation via name method.
Fixed merging issue when a route group has middleware but child routes lack it.
Added php think optimize:config command.
Improved php think route:list and php think optimize:route commands to support grouped sub‑directory rules.
Note: Log record format has been changed; built‑in log file writing now groups entries by time rather than type. If your application reads logs or uses custom drivers, adjust according to the built‑in File driver.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
