### ThinkAdmin Installation and Plugin Setup Source: https://thinkadmin.top/guide/plugin This snippet outlines the commands to create a new ThinkAdmin project, navigate into the project directory, install several key plugins (WeChat, Center, Account, Payment, Wemall) using Composer, and finally start the built-in web server. ```bash # 创建项目 composer create-project zoujingli/thinkadmin # 进入项目目录 cd thinkadmin # 安装微信插件 composer require zoujingli/think-plugs-wechat # 安装插件管理中心 composer require zoujingli/think-plugs-center # 安装多端账号管理 composer require zoujingli/think-plugs-account # 安装多端支付管理 composer require zoujingli/think-plugs-payment # 安装多端商城管理 composer require zoujingli/think-plugs-wemall # 启动 WEB 内置服务 php think run --host 127.0.0.1 ``` -------------------------------- ### Composer Environment Checks and Setup Source: https://thinkadmin.top/guide/install Verifies PHP and Composer installations, guides on updating Composer, and provides commands for installing Composer on different operating systems. Includes instructions for removing problematic proxy configurations. ```shell $ php -v # Expected output: PHP 8.1.10 (cli) (built: Aug 30 2022 18:08:04) (NTS Visual C++ 2019 x64) # Copyright (c) The PHP Group # Zend Engine v4.1.10, Copyright (c) Zend Technologies ``` ```shell $ composer -v ``` ```shell $ composer self-update ``` ```shell # Linux/MacOS X Composer Installation: curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer ``` ```shell # Windows Composer Installation: # Download Composer-Setup.exe from https://getcomposer.org/Composer-Setup.exe and run the installer. ``` ```shell # Remove Composer proxy configuration: composer config -g --unset repos.packagist ``` -------------------------------- ### ThinkAdmin Installation from Source Code Source: https://thinkadmin.top/guide/install Installs ThinkAdmin by cloning the repository from GitHub or Gitee, installing dependencies, running database migrations, and starting the built-in web server. This method typically includes default admin and wechat modules. ```shell ### Download project (ensure directory is English) # git clone https://github.com/zoujingli/ThinkAdmin git clone https://gitee.com/zoujingli/ThinkAdmin ### Navigate to project root cd ThinkAdmin ### Install project dependencies composer install --optimize-autoloader ### Initialize database and install (uses Sqlite by default) php think migrate:run ### Start PHP built-in web server ### Default login: admin/admin php think run --host 127.0.0.1 ``` -------------------------------- ### ThinkAdmin Installation via Composer Source: https://thinkadmin.top/guide/install Installs ThinkAdmin using Composer, including creating a new project, navigating into the directory, running database migrations, installing additional modules like WeChat, and starting the built-in web server. ```shell ### Create project (ensure directory is English) composer create-project zoujingli/thinkadmin ### Navigate to project root cd thinkadmin ### Initialize database and install (uses Sqlite by default) php think migrate:run ### Install WeChat management module composer require zoujingli/think-plugs-wechat ### Start PHP built-in web server ### Default login: admin/admin php think run --host 127.0.0.1 ``` -------------------------------- ### Database Configuration Example Source: https://thinkadmin.top/guide/install Illustrates how to configure database connection parameters in ThinkAdmin's `config/database.php` file. It shows setting the default database type and defining connection details for different databases like MySQL and SQLite. ```php return [ // Database type 'default' => 'sqlite', // Database connection parameters 'connections' => [ 'mysql' => [ /* Specific parameters omitted */ ], 'sqlite' => [ /* Specific parameters omitted */ ], ] ] ``` -------------------------------- ### Install Plugin Center Simple (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs a simplified version of the plugin market system for ThinkAdmin. Requires Composer for installation. ```bash composer require zoujingli/think-plugs-center-simple ``` -------------------------------- ### Install Plugin Center (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the plugin market system for ThinkAdmin, intended for managing the plugin ecosystem. Requires Composer for installation. ```bash composer require zoujingli/think-plugs-center ``` -------------------------------- ### Running ThinkAdmin Built-in Web Server Source: https://thinkadmin.top/guide/install Provides commands to run the ThinkPHP built-in web server for local development. It covers running in debug mode (showing CMD and logs) and daemon mode, along with specifying a custom port. ```shell # Run in debug mode (shows CMD and logs) $ php think run # Run in daemon mode (no CMD display) $ php think xadmin:queue webstart # Access via browser: # http://127.0.0.1:8000 # Specify a custom port: # php think run --port 8080 ``` -------------------------------- ### Install Static Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the Static initialization plugin for ThinkAdmin, typically used for managing static assets. Requires Composer for installation. ```bash composer require zoujingli/think-plugs-static ``` -------------------------------- ### Nginx Server Configuration Source: https://thinkadmin.top/guide/install Configuration for Nginx servers to handle requests by rewriting them to index.php when the requested file or directory does not exist. ```nginx if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } ``` -------------------------------- ### IIS Server Configuration (httpd.ini) Source: https://thinkadmin.top/guide/install Alternative configuration for IIS servers using ISAPI_Rewrite, by adding a specific RewriteRule to the httpd.ini file. ```iis RewriteRule (.*)$ /index.php?s=$1 [I] ``` -------------------------------- ### Install Admin Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the core Admin management plugin for ThinkAdmin. This plugin provides essential backend administration features. Requires Composer for installation. ```bash composer require zoujingli/think-plugs-admin ``` -------------------------------- ### Apache Server Configuration (.htaccess) Source: https://thinkadmin.top/guide/install Configuration for Apache servers to enable pretty URLs (mod_rewrite). This requires the mod_rewrite module to be loaded and AllowOverride set to All in the httpd.conf. ```apache Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] ``` -------------------------------- ### Install WeChat Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the WeChat integration plugin for ThinkAdmin, enabling WeChat functionalities. Requires Composer for installation. ```bash composer require zoujingli/think-plugs-wechat ``` -------------------------------- ### Install Account Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the multi-terminal user account system plugin for ThinkAdmin. This is a member-exclusive plugin, requiring VIP authorization for commercial use. ```bash composer require zoujingli/think-plugs-account ``` -------------------------------- ### IIS Server Configuration (web.config) Source: https://thinkadmin.top/guide/install Configuration for IIS servers using the rewrite module to handle requests. This involves adding a rewrite rule to the web.config file. ```iis ``` -------------------------------- ### Install Payment Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the multi-terminal payment management system plugin for ThinkAdmin. This is a member-exclusive plugin, requiring VIP authorization for commercial use. ```bash composer require zoujingli/think-plugs-payment ``` -------------------------------- ### View Installed Packages with Composer Source: https://thinkadmin.top/guide/changes This command displays a list of installed Composer packages, their versions, and descriptions. It's useful for understanding project dependencies and managing package versions. Requires Composer to be installed and run in the project root. ```Shell D:\WebRoot\ThinkAdmin>composer info bacon/bacon-qr-code 2.0.8 BaconQrCode is a QR code generator for PHP. dasprid/enum 1.0.6 PHP 7.1 enum implementation psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11) psr/http-message 1.1 Common interface for HTTP messages psr/log 3.0.2 Common interface for logging libraries psr/simple-cache 3.0.0 Common interfaces for simple caching symfony/process 6.4.15 Executes commands in sub-processes topthink/framework 8.1.2 The ThinkPHP Framework. topthink/think-container 3.0.1 PHP Container & Facade Manager topthink/think-helper 3.1.10 The ThinkPHP6 Helper Package topthink/think-migration 3.1.1 topthink/think-orm 4.0.3 the PHP Database&ORM Framework topthink/think-template 3.0.2 the php template engine topthink/think-validate 3.0.4 think validate topthink/think-view 2.0.4 thinkphp template driver zoujingli/ip2region 2.0.6 Ip2Region for PHP zoujingli/qrcode 1.0.3 Endroid QrCode for ThinkAdmin zoujingli/think-install 1.0.49 Plugin Installer for ThinkAdmin zoujingli/think-library 6.1.80 Library for ThinkAdmin zoujingli/think-plugs-admin 1.0.68 Admin Plugin for ThinkAdmin zoujingli/think-plugs-static 1.0.118 Static Files for ThinkAdmin zoujingli/think-plugs-wechat 1.0.41 WeChat Plugin for ThinkAdmin zoujingli/wechat-developer 1.2.67 WeChat and Alipay Platform Development ``` -------------------------------- ### Install Worker Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the network service plugin based on Workerman for ThinkAdmin, providing robust network capabilities. Requires Composer for installation. ```bash composer require zoujingli/think-plugs-worker ``` -------------------------------- ### Install Wuma Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the one-item-one-code traceability system plugin for ThinkAdmin. This plugin is currently under development and requires paid authorization for commercial use. ```bash composer require zoujingli/think-plugs-wuma ``` -------------------------------- ### Composer Commands for ThinkAdmin Updates and Management Source: https://thinkadmin.top/guide/upgrade Provides essential Composer commands for managing ThinkAdmin project dependencies. This includes updating Composer itself, optimizing autoloaders, installing specific plugins, and updating all project components to their latest compatible versions. ```APIDOC Composer Management Commands: 1. Update Composer to the latest version: composer self-update 2. Update all project components and optimize autoloading: composer update --optimize-autoloader 3. Install a specific ThinkAdmin plugin (e.g., ThinkPlugsAdmin): composer require zoujingli/think-plugs-admin --optimize-autoloader 4. Update a specific ThinkAdmin component (e.g., ThinkLibrary): composer update zoujingli/think-library --profile --prefer-dist --optimize-autoloader 5. Update a specific ThinkAdmin plugin module (e.g., ThinkPlugsAdmin): composer update zoujingli/think-plugs-admin --profile --prefer-dist --optimize-autoloader 6. Update another ThinkAdmin plugin module (e.g., ThinkPlugsWechat): composer update zoujingli/think-plugs-wechat --profile --prefer-dist --optimize-autoloader 7. General update for all modules and components: composer update --profile --prefer-dist --optimize-autoloader Note: Before executing major updates, it is recommended to back up your project and consider deleting the 'vendor' directory and 'composer.lock' file if encountering issues. ``` -------------------------------- ### Install WeChat Mall Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the multi-terminal WeChat mall system plugin for ThinkAdmin. This is a member-exclusive plugin, requiring VIP authorization for commercial use. ```bash composer require zoujingli/think-plugs-wemall ``` -------------------------------- ### Install WeChat Service Plugin (ThinkAdmin) Source: https://thinkadmin.top/guide/plugin Installs the WeChat open platform basic plugin for ThinkAdmin. This is a member-exclusive plugin, requiring VIP authorization for commercial use. ```bash composer require zoujingli/think-plugs-wechat-service ``` -------------------------------- ### Naming Conventions Source: https://thinkadmin.top/guide/attention Details common naming conventions used in programming, including Camel Case, Pascal Case, Kebab Case, and Snake Case, with examples and recommended use cases. ```APIDOC Naming Conventions: 1. Camel Case (camelCase): - Description: Words are joined without spaces. All words except the first start with a capital letter. - Examples: camelCase, myVariableName, myUrl, getUsers, eBay, iPhone - Usage: Widely used in JavaScript, Java, PHP, C++, C#. 2. Pascal Case (PascalCase): - Description: Words are joined without spaces. Every word starts with a capital letter. - Examples: PascalCase, MyVariableName, MyUrl, GetUsers, PlayStation, MasterCard - Usage: Common in Pascal programming language and for naming classes in PHP. 3. Kebab Case (kebab-case): - Description: Words are in lowercase and connected by hyphens. - Examples: kebab-case, my-variable-name, my-url - Usage: Recommended for URLs, naming images, PDFs, and other web files. Also used for HTML and CSS class/ID names. 4. Snake Case (snake_case): - Description: Words are in lowercase (or uppercase) and connected by underscores. - Examples: snake_case, my_variable_name, my_url - Usage: Used in PHP, Ruby, and Python. A common variant uses all uppercase with underscores for constants (e.g., MY_CONSTANT_NAME). ``` -------------------------------- ### Composer Configuration for PHP 8 Upgrade Source: https://thinkadmin.top/guide/upgrade Specifies the 'require' section in composer.json to ensure compatibility with PHP 8 and manage ThinkAdmin dependencies. It lists essential packages like topthink/framework, topthink/think-view, and specific zoujingli/ packages with version constraints. ```json { "require": { "php": ">=7.1", "ext-json": "*", "topthink/framework": "^6.0|^8.0", "topthink/think-view": "^1.0|^2.0", "zoujingli/ip2region": "^1.0|^2.0|@dev", "zoujingli/think-install": "^1.0|@dev", "zoujingli/think-library": "^6.1|@dev" } } ``` -------------------------------- ### ThinkAdmin v6.1 Default Directory Structure Source: https://thinkadmin.top/guide/structure Provides the default directory layout for ThinkAdmin v6.1 after installing ThinkPlugsAdmin and ThinkPlugsWechat plugins. It details the structure of application directories, global configuration, public-facing assets, runtime data, and vendor libraries, along with notes on automatic loading of system files. ```text .\n├─ app 应用基础目录\n│ ├─ admin 后台应用目录( 不建议修改,可使用插件更新 )\n│ │ ├─ controller 应用控制器目录\n│ │ ├─ route 应用路由配置\n│ │ ├─ view 应用视图目录\n│ │ └─ Service.php 服务注册文件\n│ ├─ index 默认应用入口\n│ │ └─ controller 控制器目录\n│ └─ wechat 微信应用目录( 不建议修改,可使用插件更新 )\n│ ├─ command 应用指令目录\n│ ├─ controller 应用控制器目录\n│ ├─ service 应用服务目录\n│ ├─ view 应用视图目录\n│ └─ Service.php 服务注册文件\n├─ config 全局配置目录\n│ ├─ app.php 全局应用配置\n│ ├─ cache.php 全局缓存配置\n│ ├─ cookie.php 全局 Cookie 配置\n│ ├─ database.php 数据库连接配置\n│ ├─ phinx.php 数据库迁移配置\n│ ├─ lang.php 系统多语言配置\n│ ├─ log.php 全局日志配置\n│ ├─ route.php 路由和URL配置\n│ ├─ session.php 访问会话配置\n│ └─ view.php 视图模板配置\n├─ public 网站开放目录\n│ ├─ static 静态资源目录\n│ │ ├─ extra 自定义扩展目录\n│ │ ├─ plugs 后台应用插件( 不建议修改,可使用插件更新 )\n│ │ └─ theme 后台应用主题( 不建议修改,可使用插件更新 )\n│ ├─ upload 上传存储目录\n│ ├─ index.php 网站访问入口( 不建议修改,可使用插件更新 )\n│ ├─ router.php 网站测试入口( 不建议修改,可使用插件更新 )\n│ └─ think 指令访问入口( 不建议修改,可使用插件更新 )\n├─ runtime 运行环境目录,需要可写权限\n│ ├─ admin 系统应用运行目录\n│ ├─ cache 系统默认缓存目录\n│ ├─ log 系统运行日志目录\n│ ├─ session Session 会话缓存\n│ └─ wechat 微信运行目录缓存\n├─ safefile 安全文件上传目录,需要读写权限\n└─ vendor Composer 安装的第三方类库目录 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.