PHP × Chinese Developer Ecosystem
What Is ThinkPHP? A PHP Framework from China
What happens when a colleague from China is unfamiliar with Laravel? Start from my own conversation, then compare ThinkPHP and Laravel through real code, database behaviour, and project decisions.
01 / PHP FRAMEWORK
A framework gives your PHP application a structure
ThinkPHP is an open-source PHP web framework from the TOPThink ecosystem, released under the Apache 2.0 license. It provides conventions and tools for handling HTTP requests, organizing application code, and producing responses. Instead of wiring every page together yourself, you build on an established application structure.
It belongs on the server side, in the same broad category as Laravel. Vue handles interfaces in the browser; ThinkPHP can provide the JSON API those interfaces consume.
- Backend framework
- PHP + Composer
- HTML pages or JSON APIs
02 / A NOTE FROM MY OWN EXPERIENCE
I asked a coworker from China about Laravel. They were unfamiliar with it.
That was my experience in a direct conversation with someone I work with. It made the difference between the technology circles we encounter feel concrete: a framework familiar in one environment can be unfamiliar in another.
What I experienced
The coworker I spoke with was unfamiliar with the Laravel framework.
What we can also verify
Laravel China has Chinese-language documentation and community discussions. That establishes a community's presence; measuring familiarity across China would require separate data.
Explore Laravel China ↗Start a conversation with the team's actual projects, tools, and working language. That tells you which framework knowledge will be useful next.
03 / TOOLBOX
Six pieces you will keep meeting
Routing
A route connects an HTTP method and URL pattern to application code. Explicit routes make an endpoint easier to locate, review, and test than guessing which file handles a request.
Controllers
A controller coordinates the request: read validated input, call application logic, and return a response. Keeping it focused makes the next change easier to understand.
Data and models
ThinkORM supports database work through queries and models. A model can organize data behavior, while larger business rules may belong in a separate service. A greeting endpoint needs neither a database nor an ORM.
Middleware
Middleware runs around request handling. It is a useful place for shared concerns such as authentication or request logging, instead of repeating the same checks inside every controller.
Validation
Validation describes the input an operation accepts. Check required values, formats, and lengths before processing them; checking a request is different from deciding whether a user has permission.
Composer and extensions
Composer manages PHP dependencies. Templates, queues, and other integrations can involve additional packages, so check the installed project rather than assuming every feature ships in the core framework.
04 / REQUEST → RESPONSE
Follow one request, one step at a time
Use a name you recognize and step through a greeting endpoint. Watch which responsibility changes at each stage, rather than treating the framework as a mysterious box.
Route
The URL matches the hello route. Its name segment becomes a parameter passed to Learn/hello; the route selects the handler, rather than creating the response itself.
<?php
use think\facade\Route;
Route::get('hello/:name', 'Learn/hello');Local learning simulation. No PHP executes here, and the name is not sent to a server or stored.
05 / FIRST ENDPOINT
Build a small endpoint you can actually inspect
Start in a separate learning directory. The goal is a working route and a response you understand, before adding a database, login flow, or admin panel.
Use Composer and a supported PHP version compatible with the dependencies you install. The ThinkPHP 8 project requires PHP 8.0 or later, but a minimum requirement is not a recommendation to use an unsupported PHP release.
Create a separate project
Install the official project with Composer, enter its directory, and start the development server bound to localhost. This is a local exercise; do not expose the development server as a production service.
composer create-project topthink/think thinkphp-demo cd thinkphp-demo php think run --host 127.0.0.1 --port 8000Declare the route
In this newly created single-application project, replace the sample contents of route/app.php with the shown code. Alternatively, add only the route line after its existing import; do not duplicate the PHP opening tag or use statement. The name segment is passed to Learn/hello.
<?php use think\facade\Route; Route::get('hello/:name', 'Learn/hello');Add the controller
Create app/controller/Learn.php with the app\controller namespace. The method returns a small JSON object using the supplied name. No database credentials or extra template package are necessary for this example.
<?php namespace app\controller; use app\BaseController; use think\response\Json; class Learn extends BaseController { public function hello(string $name = 'World'): Json { return json([ 'framework' => 'ThinkPHP', 'name' => $name, 'message' => 'Hello, ' . $name . '!', ]); } }Read the response, then change one thing
Open the local hello URL and try another name. Compare the real response with the simulation, inspect the files involved, and check dependencies with composer audit. Before deployment, review authentication, validation, production configuration, and the web server document root.
curl http://127.0.0.1:8000/hello/Julio composer audit
06 / THINKPHP × LARAVEL
ThinkPHP and Laravel, compared where the code actually changes
Choose a topic to compare conventions, defaults, and the practical consequence for the same application. Similar feature names do not guarantee interchangeable code.
Scope: ThinkPHP 8.x and Laravel 13.x. Package versions, starter kits, and project configuration can change the details.
Explore the differencesCan both run in the same PHP environment?
ThinkPHP 8.x
A Composer project with a PHP 8.0 minimum.
- The application skeleton and core framework are separate packages with separate versions.
- ThinkPHP uses Apache-2.0 licensing; inspect extension licenses separately.
Laravel 13.x
Laravel 13 requires PHP 8.3 or later.
- Installation choices can add a frontend stack, starter kit, and test tooling.
- Laravel uses MIT licensing; installed packages have their own terms.
What this changes in practice
Check PHP extensions and the lockfile before choosing hosting. Prefer a maintained PHP release compatible with the whole dependency tree.The differences at a glance
Open this reference when reading a real repository. These are conventions to check, not scores for a universal winner.
| Area | ThinkPHP 8.x | Laravel 13.x |
|---|---|---|
| Runtime / license | PHP ≥8.0 · Apache-2.0 | PHP ≥8.3 · MIT |
| Route file | route/app.php | routes/web.php; API routing is optional |
| Route parameter | hello/:name | /hello/{name} |
| Controller location | app/controller | app/Http/Controllers |
| Database reads | ThinkORM · select() | Query builder / Eloquent · get() |
| Required validation rule | require | required |
| Validation response | Define the handler / JSON contract | JSON requests normally receive 422 |
| Middleware setup | app/middleware.php | bootstrap/app.php and middleware groups |
| HTML templates | ThinkView driver + ThinkTemplate | Blade; other frontend options available |
| Queues / migrations | Compatible ecosystem extensions | Framework conventions and Artisan commands |
| Test workflow | Select and configure the project test suite | Documented PHPUnit/Pest and HTTP helpers |
| Production web root | public/ | public/ |
SAME TASK / TWO IMPLEMENTATIONS
Same task, two ways to express it
Compare equivalent operations side by side. Follow the imports, route syntax, query ending, and error handling rather than counting lines.
Return a greeting for the name in the URL.
ThinkPHP: route/app.php. Laravel: routes/web.php. Both examples use a route closure so their structure is comparable.
ThinkPHP 8.x
route/app.php
<?php
use think\facade\Route;
Route::get('hello/:name', function (string $name) {
return json([
'name' => $name,
'message' => 'Hello, ' . $name . '!',
]);
});Laravel 13.x
routes/web.php
<?php
use Illuminate\Support\Facades\Route;
Route::get('/hello/{name}', function (string $name) {
return response()->json([
'name' => $name,
'message' => 'Hello, ' . $name . '!',
]);
});These GET examples return JSON without a database. An existing route file may already contain the PHP opening tag and imports.
CONTEXT / NOT A LEADERBOARD
Choose a learning path from your situation
Select the situation closest to yours and turn the comparison into a small, practical plan.
Start with the application you must maintain
Learning the installed ThinkPHP version gives you a direct route to useful changes.
- Read composer.lock, route configuration, middleware, and the deployment entry point.
- Trace one real endpoint from input through data access to its response.
- Add a regression check before changing the endpoint or upgrading packages.
07 / YOUR NEXT MOVE
Choose a path based on the work in front of you
ThinkPHP is useful to explore when…
- You maintain a ThinkPHP codebase. Trace one real feature from route to controller and response before changing its architecture.
- You collaborate with a team using Chinese PHP resources. Read a small documentation chapter, then map unfamiliar terminology to code you can run.
- You already know Laravel and want a second set of conventions. Rebuild a tiny read-only endpoint and compare how each project organizes it.
Keep these fundamentals in the plan
- Learn modern PHP, Composer, HTTP methods, status codes, and error handling. Framework shortcuts are much easier to evaluate once you know what they hide.
- Practice validation, authorization, and database queries separately. Returning successful JSON is only the first step toward a trustworthy application.
- Test the behavior you need, document deployment assumptions, and check your dependency lockfile into version control. Reproducibility helps whichever framework you choose.
08 / 中文 × CODE
Six Chinese terms that make the docs less intimidating
- 框架kuàng jià
- Framework: the structure and conventions your application builds on.
- 路由lù yóu
- Routing: connecting a URL and HTTP method to a handler.
- 控制器kòng zhì qì
- Controller: code that coordinates a request and its response.
- 模型mó xíng
- Model: an abstraction for data behavior; its exact role depends on the application's design.
- 中间件zhōng jiān jiàn
- Middleware: shared processing around request handling.
- 验证yàn zhèng
- Validation: checking that input meets the rules of an operation.
09 / READY TO BUILD
A small pre-deployment checkpoint
Use this learning checklist to spot the next task. Ticking every box is not a substitute for testing your own application.
0/6 checkpoints reviewed
10 / FAQ
Questions worth asking before choosing a framework
Why had my coworker from China not heard of Laravel?
In the conversation described here, my coworker was unfamiliar with Laravel. Laravel China also has documentation and community discussions. These observations describe different experiences; the useful next question is which tools and projects a particular team actually works with.
Does learning ThinkPHP mean replacing Vue?
No. ThinkPHP runs PHP on the server; Vue builds interfaces. They can communicate through HTTP APIs, or ThinkPHP can render server-side pages. This website remains a Vue portfolio.
Must every request use a model and a template?
No. A simple JSON greeting can use a route and a controller without a database or template. Use models, services, and presentation tools when the application's requirements justify them.
Can I copy an old ThinkPHP tutorial into a new project?
Check its framework and package versions first. Directory layout, configuration, extensions, and APIs can differ between major releases. Start with the documentation for your installed version, then verify the example locally.
11 / REFERENCES
Follow the original sources
Use the official project, framework repository, and documentation as the technical reference. Community resources help explain context; popularity claims still need separate evidence.