topthink/think-orm
ThinkORM is the PHP ORM behind ThinkPHP, offering ActiveRecord-style models, a fluent query builder, relationships, events, soft deletes, and multi-database support. Use it with ThinkPHP or standalone for expressive, efficient database access.
Architecture fit. ThinkORM is the standalone ORM extracted from ThinkPHP, a different PHP framework with a different application lifecycle, container, event system, and model conventions. Laravel's architecture is built around Eloquent + the DB facade: service container bindings, model events, policies, API resources, factories, migrations, Telescope/Debugbar introspection, queue serialization, and RefreshDatabase all assume Eloquent. ThinkORM sits outside all of that. It can run standalone inside a Laravel process (it uses PDO and PSR interfaces), but it is a parallel data layer, not a drop-in. Fit is poor for greenfield Laravel; conditionally acceptable only as a coexistence layer during a legacy migration or to reuse a shared ThinkPHP library.
Integration feasibility. Composer-installable, Apache-2.0, no dependency conflicts expected (PSR-3/PSR-16 based). There is no official Laravel service provider, so the integration is bespoke: config bootstrap (Db::setConfig), a container binding, connection lifecycle management, and a testing harness are all yours to build and own. Feasible in a spike; non-trivial in production.
Technical risk.
create_time/update_time and delete_time for soft deletes, versus Laravel's created_at/updated_at/deleted_at. Query-builder vocabulary differs (field/select/find/insert vs select/first/get/create).think\Paginator returns list/total/per_page/current_page, not Laravel's data/meta. API resources and Inertia/Livewire boundaries will need adapters.Key questions to answer before committing.
Stack fit. Treat ThinkORM as a scoped, secondary data access layer — never as a replacement for Eloquent, and never as the default choice for new code. Isolate it behind repository interfaces so application code depends on the interface, not on think\Db or think\Model. Bind think\Db as a singleton in a service provider, hydrate its config from config/database.php at boot, and register a shutdown hook to close connections.
Migration path (the realistic use case). Phased ThinkPHP→Laravel cutover:
Compatibility checklist. PHP 8.x and PDO drivers are fine. Validate: timestamp/soft-delete column conventions (either align the schema or override ThinkORM's autoWriteTimestamp and soft-delete field names), pagination response shape against existing API contracts, transaction semantics at the request boundary, and model event hooks that Laravel listeners won't see. Confirm psr/log and psr/simple-cache versions resolve cleanly against the Illuminate stack.
Sequencing.
RefreshDatabase equivalent that truncates or rolls back ThinkORM connections; without this, CI coverage of the legacy half of the app degrades.Maintenance. You own the Laravel glue permanently. Upstream releases regularly (recent release date) and Apache-2.0 gives fork safety, but every Laravel major upgrade, PHP minor bump, and PDO/driver change must be validated against a second data layer that no Laravel maintainer tests. Budget ongoing adapter maintenance, not a one-time integration.
Support. Documentation and issue triage are predominantly Chinese-language; expect slower resolution for English-reported defects and timezone friction. Pin to a specific version, subscribe to upstream releases, and treat any SQL-injection or deserialization advisory as high-severity until patched — you have no vendor SLA.
Scaling. Throughput for typical OLTP is comparable to Eloquent; the ORM itself is not the bottleneck. The operational scaling risks are elsewhere: two connection pools per PHP-FPM worker or Octane worker, double the open connections, and connection reuse behavior under long-running workers that differs from Laravel's own DB manager. Under Octane, verify ThinkORM's connection caching does not leak state across requests. N+1 behavior follows the ORM's own relation-loading semantics (with/withJoin), which engineers will get wrong by reflex.
Failure modes to instrument for.
Ramp-up. A competent Laravel developer needs roughly two to four weeks to be productive in ThinkORM (query builder vocabulary, relation loading, model conventions, pagination shape). On-call readiness is the larger cost: responders must hold two mental models, two debugging toolchains, and know which layer owns a given table. That is a durable tax on the team, not a one-time onboarding cost — and it is the strongest argument for time-boxing ThinkORM's presence in the stack rather than letting it settle in as a permanent second ORM.
How can I help you explore Laravel packages today?