Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Think Orm Laravel Package

webman/think-orm

Integrates ThinkORM with webman, bringing ThinkPHP's ORM, models, and query builder to webman applications. Configure database connections and use familiar ThinkORM APIs for rapid PHP development.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Framing correction (read first). Despite the "Laravel/PHP package" framing, webman/think-orm is not a Laravel package and has no relationship to Eloquent, the Laravel service container, or illuminate/database. It is a webman framework plugin (Workerman-based, resident-memory PHP application server) that wires topthink/think-orm — the standalone ORM extracted from ThinkPHP — into webman's bootstrap and config lifecycle. Any evaluation that assumes Laravel idioms (Eloquent models, RefreshDatabase, Telescope, queue/transaction helpers) will produce the wrong conclusion. Treat this as a webman-only, ThinkPHP-ecosystem decision.

Architecture fit. The package is deliberately thin: it registers the ORM as a webman plugin, publishes a config file, and calls Db::setConfig() so the ThinkORM static facade resolves against app config. That is the correct architectural shape for webman — it keeps the ORM outside the framework core and lets the plugin be swapped for webman/database (illuminate-based) without touching application code structure. Fit is good if and only if the surrounding stack is webman and the team's model layer is written against ThinkORM's Model/Db API. Fit is poor for a Laravel codebase, a Symfony codebase, or a team standardized on Eloquent.

Integration feasibility. Low mechanical effort, high semantic effort:

  • Mechanical: composer require webman/think-orm, run the plugin install command to publish config, set connection params, done. Hours, not weeks.
  • Semantic: ThinkORM's query builder, relations (hasOne/hasMany/belongsToMany differ in naming and lazy/eager loading syntax), soft deletes, model events, and Db::raw behavior are similar but not identical to Eloquent. Any ported model layer needs line-by-line review. Budget for this, not for the install.

Technical risk — the resident-memory problem is the whole risk. In webman, worker processes persist across requests and the ORM's connection/transaction state is process-static. Consequences a TPM must force onto the table:

  1. Transaction bleed. An uncommitted/rolled-back transaction left open on an exception path is inherited by the next request on that worker. This is a correctness bug class, not a performance one. Requires a mandatory per-request cleanup hook (onWorkerStart/request-end middleware calling rollback-if-active and Db::close() where appropriate).
  2. Stale connections. MySQL wait_timeout silently kills idle connections; without reconnect handling you get "server has gone away" under low traffic followed by a traffic spike.
  3. Connection math. Connections = workers × per-worker connections (× pool size if pooling is enabled). webman routinely runs 8–32+ workers per instance; this multiplies against max_connections fast and is invisible in FPM-based capacity models.
  4. Coroutine safety. ThinkORM's static connection manager is not coroutine-isolated. If the deployment uses Swoole/Swow coroutines or async HTTP clients interleaved with DB work in the same process, state can interleave. Verify concurrency model before adopting.
  5. Version matrix. topthink/think-orm 2.x vs 3.x, PHP 8.x, webman 1.x vs 2.x — pin explicitly and test the exact triple.

Signal quality. 9 stars and 0 dependents means no meaningful external validation. Mitigating factor: it lives in the webman-php organization, so it is effectively semi-official and maintained alongside the framework rather than by a random contributor. Last release dated 2026-03-25 indicates active upkeep. The 9.52 quality score versus 39.67 opportunity score reads as "does its narrow job well, but the addressable audience is small" — appropriate for infrastructure glue, not a strategic bet.

Key questions to answer before approval

  • Is our application actually on webman, or are we evaluating webman? If Laravel: stop here.
  • Greenfield model layer, or migration from Eloquent/PDO/other? If migration, how many models and raw queries?
  • What is our worker count per instance and per-worker connection budget, and what is the DB's max_connections?
  • Do we run Swoole/Swow coroutines anywhere in the request path?
  • Who owns the per-request DB state reset, and is it enforced by middleware or by convention (i.e., will it silently rot)?
  • Do we need read/write splitting, sharding, or a connection pool? Confirm plugin support rather than assuming parity with webman/database.
  • What is our fallback if upstream stalls — vendored fork, or swap to webman/database?

Integration Approach

Stack fit. Adopt only where the stack is: PHP 8.x + webman 2.x + MySQL/PostgreSQL + topthink/think-orm 3.x. This package is the only supported path to ThinkORM on webman; there is no alternative vendor to evaluate against, so the real comparison is ThinkORM-on-webman versus illuminate-on-webman (webman/database), not this package versus other packages.

Migration path. Do not run both ORMs. Two connection managers in one resident process means double the connection footprint, two transaction semantics, and two places for state to leak. Choose one.

  • Greenfield: install plugin, define config, extend ThinkORM Model, adopt Db:: for raw queries. Straightforward.
  • From Eloquent: rewrite model layer against ThinkORM API in a branch, keep the schema untouched, and validate via a data-access test suite that exercises relations and pagination specifically (highest-divergence areas). Do not attempt side-by-side dual-write.
  • From raw PDO: lowest risk; map queries to Db::table() and keep transactions explicit.

Compatibility. Pin webman/think-orm, topthink/think-orm, workerman/webman-framework, and PHP in composer.json with exact or ~ constraints, and run CI against that matrix. The plugin is glue code — the version risk lives in the ORM and framework it bridges, so that is where the lockfile discipline belongs.

Sequencing.

  1. Spike (1–2 days): throwaway webman app, plugin installed, one model, one transaction, one forced-exception path, run 10k requests through wrk/ab to surface connection and transaction-state behavior. This spike answers most of the risk above cheaply.
  2. State-hygiene hardening: middleware + exception handler enforcing rollback-on-error and connection reset. Land this before feature work, not after.
  3. Pilot service: migrate one bounded-context service or a read-only reporting module. Measure connection counts under load.
  4. Broaden: remaining services, one at a time, with the data-access test suite as the gate.
  5. Decommission the prior ORM and its config in the same release — leaving both installed is the most common failure mode.

Operational Impact

Maintenance. Low code surface (thin adapter), but the maintenance burden is transferred to the pinned ORM and framework versions. Small team, semi-official stewardship, MIT license — no vendor relationship, no SLA, no support contract. Acceptable for internal tooling; needs a named internal owner either way. Budget a recurring dependency-review line item, not a one-off.

Support. No commercial support. Recourse is GitHub issues on webman-php repos and community channels (notably Chinese-language, which is where the webman/ThinkPHP community concentrates — factor in language capability for on-call). Escalation path is "read the source" or "vendor it."

Scaling. Scales with processes, not with requests — the opposite of FPM intuition. Capacity planning must be expressed as workers × connections, and autoscaling must account for connection count as a first-class resource, with a hard ceiling against the database's max_connections. Under horizontal scaling this becomes the binding constraint well before CPU does. If pooling is required, confirm whether the plugin's pool support meets requirements or whether a separate pool plugin is needed — do not assume.

Failure modes to instrument.

  • Stale/dead connection after idle period → "MySQL server has gone away"; monitor error rate by worker age.
  • Open transaction carried across requests → cross-request data corruption; detect via invariant checks and a request-scoped assertion in staging.
  • Connection exhaustion at deploy time — start.php reload churns workers and connections in bursts; stagger reloads and watch DB connection graphs during deploys.
  • Silent query-log gaps; wire Db::listen (or equivalent) into existing APM early, since the Laravel observability ecosystem is unavailable.
  • Worker memory growth from ORM static caches — track per-worker RSS over multi-day runs.

Ramp-up. Developers with ThinkPHP background: hours. Developers whose only ORM experience is Eloquent or Doctrine: days, with the divergence concentrated in relations, eager loading, and model events. Produce a short internal "Eloquent → ThinkORM" cheat sheet during the pilot; it pays for itself in the first sprint.

Recommendation. Proceed only if the application is genuinely webman-based and the team accepts the ThinkORM model API. Otherwise this is a non-starter and the correct evaluation target is webman/database with Eloquent. Conditional on adoption: gate on the spike completing, mandate per-request DB state hygiene before feature work, pin the full version matrix, and record the low-adoption/single-maintainer risk as an accepted, owner-assigned risk in the decision log.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource