Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsMay 19, 2026·3 min de lecture

ThinkPHP — Lightweight Rapid Development PHP Framework

ThinkPHP is a lightweight PHP framework focused on rapid application development with convention-over-configuration design, widely adopted in the Chinese PHP development community.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
ThinkPHP Overview
Commande CLI universelle
npx tokrepo install 3e6c431a-53c1-11f1-9bc6-00163e2b0d79

Introduction

ThinkPHP is a PHP framework with over two decades of development history, designed for fast web application development with a low learning curve. It follows convention-over-configuration principles and provides a complete toolkit for building web applications and APIs.

What ThinkPHP Does

  • Provides an MVC architecture with automatic routing and URL rewriting
  • Includes an ORM with query builder and model relationships
  • Offers built-in template engine with tag library support
  • Supports middleware, events, and service providers
  • Provides CLI tools for code generation and task scheduling

Architecture Overview

ThinkPHP uses a multi-application architecture where a single installation can host multiple independent applications. The request lifecycle flows through middleware stacks, route matching, controller dispatch, and response rendering. The framework supports both traditional request-response and command-line application modes, with a service container managing dependency injection.

Self-Hosting & Configuration

  • Install via Composer with composer create-project topthink/think
  • Configure database and app settings in the config/ directory
  • Use environment files (.env) for deployment-specific values
  • Run the built-in development server with php think run
  • Deploy with Nginx or Apache and PHP-FPM in production

Key Features

  • Multi-application support within a single project installation
  • Fluent query builder with chainable database operations
  • Built-in caching with drivers for Redis, Memcached, and file
  • Route annotations and automatic controller-based routing
  • Command-line toolkit for migrations, seeds, and custom commands

Comparison with Similar Tools

  • Laravel — feature-rich with larger ecosystem; ThinkPHP offers a simpler learning curve for rapid development
  • Yii2 — similar full-stack approach; ThinkPHP has stronger adoption in the Chinese PHP community
  • Symfony — component-based and enterprise-grade; ThinkPHP prioritizes speed of development
  • CodeIgniter — lightweight and simple; ThinkPHP provides more built-in features like multi-app support
  • Slim — micro framework for APIs; ThinkPHP is a full-stack framework with views and ORM

FAQ

Q: Is ThinkPHP documentation available in English? A: The primary documentation is in Chinese, though community translations and the codebase itself use English for class and method names.

Q: What PHP version does ThinkPHP require? A: ThinkPHP 8.x requires PHP 8.0 or higher.

Q: Can ThinkPHP be used for API development? A: Yes. ThinkPHP supports RESTful routing, JSON responses, and API-specific middleware out of the box.

Q: How does ThinkPHP handle database migrations? A: ThinkPHP includes a migration system accessible via php think migrate:run with support for creating and rolling back schema changes.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires