Exploring SAPI++: A Multi‑Tenant SaaS Framework Powered by ThinkPHP 6.x
SAPI++ is an open‑source multi‑application, multi‑tenant SaaS framework built on ThinkPHP 6.x, offering out‑of‑the‑box installation, API authentication, menu integration, and support for various front‑end technologies; the article details its features, advantages, required environment, and directory layout for developers.
1. Open‑Source Project Overview
SAPI++ is a multi‑application, multi‑tenant, multi‑terminal SaaS platform development framework. Built on ThinkPHP 6.x’s multi‑application mode, developers can create their own SaaS service platform without additional learning; simplicity and ease of use are its hallmarks.
2. Open‑Source License
The project is released under the GPL‑3.0 license.
3. Interface Showcase
4. Feature Overview
Features of SAPI++ v2.0
Out‑of‑the‑box : Quick installation within minutes; after setup you can start development without complex configuration.
Application Isolation : Supports separate databases and tables, allowing tenants to manage data security themselves.
Convenient and Fast : No Vue framework, no compilation; based on native jQuery with a unified entry point.
API Authentication : Integrates standardized API logic, conforms to REST design principles, and includes system authentication mechanisms.
Menu Integration : Interface‑based menu integration lets applications attach to any menu module without backend configuration.
Elegant Styles : Provides independent, refined CSS UI styles for the SAPI++ admin console.
Independent Domain : Each tenant can bind an independent domain (e.g., WEB/H5 can have separate access).
Advantages of SAPI++ v2.0
Integration with WeChat Open Platform, enabling one‑click authorization and deployment of SaaS applications (WeChat Mini‑Programs).
Comprehensive WeChat public‑account and Mini‑Program authorization system, fully encapsulated via API, requiring no additional development.
Supports Vue/React front‑end and back‑end separation, SSR, and hybrid development.
Supports building independent apps for Android, iOS, public accounts, Mini‑Programs, H5, PC, etc.
Tenant purchase, authorization, recharge, and billing management.
Complete membership account system with unlimited hierarchical management.
Tenants can simultaneously purchase authorizations for countless product applications.
5. Technical Stack
Environment Requirements
Framework: ThinkPHP6.x (WeChat development framework)
Environment: PHP 8.0.2 + MySQL
System: Windows, Linux (recommended)
PHP >= 8.0.2
Nginx >= 1.14 or Apache >= 2.4
MySQL >= 5.7 (InnoDB engine)
Redis >= 5.0
PHP extensions: fileinfo, curl, openssl, simpleXML, redis, mbstring, mysqli, gd, zip6. Directory Structure
Please follow the naming conventions to reduce unnecessary errors during development.
SAPI++ follows the same directory layout as ThinkPHP 6.x; refer to the official ThinkPHP manual for details.
In actual deployment, ensure only the public directory is externally accessible. On macOS or Linux, set the runtime directory permissions to 777.
├─app Application directory
│ ├─module_name1 Application name
│ │ ├─common.php Functions file
│ │ ├─config Config directory
│ │ │ ├─admin.php Admin menu config
│ │ │ ├─Tenant.php Tenant menu config
│ │ │ ├─version.php Application config info
│ │ ├─api Controller directory
│ │ │ ├─v1_0 API directory (v1_x_x spec)
│ │ │ ├─service No‑signature API directory
│ │ ├─web Web controllers (url.com/web/client_id)
│ │ │ ├─web PC/H5 website
│ │ │ ├─app App webview content
│ │ │ ├─wechatmp Public account
│ │ │ ├─wechatapp Mini‑Program webview content
│ │ ├─controller Controller directory
│ │ ├─admin Backend management
│ │ ├─tenant Tenant management
│ │ ├─... Create directly under controller if no backend
│ │ ├─model Model directory
│ │ ├─view View directory
│ │ └─... Additional libraries
│ ├─module_name2 Another application
│ │ └─... Same structure as above
│ └─event.php Event definitions
│ ├─common.php Global functions
│ ├─provider.php Service provider definitions
│ ├─service.php Global system services
│ └─middleware.php Global middleware
├─config Global config directory
│ ├─app.php Application config
│ ├─config.php Third‑party integration config
│ ├─filesystem.php OSS/COS/Qiniu/local upload keys
│ └─... Other configs (see ThinkPHP manual)
├─base Core SAPI++ directory
│ ├─logic System extensions
│ ├─model Base models
│ │ ├─SystemAdmin.php System administrator
│ │ ├─SystemAgent.php Agent
│ │ ├─SystemApp.php Application installer
│ │ ├─SystemApps.php Tenant applications
│ │ ├─SystemAppsClient.php Tenant app integration
│ │ ├─SystemAppsConfig.php Tenant app config
│ │ ├─SystemAppsRelease.php Tenant app release status
│ │ ├─SystemTenant.php Tenant management
│ │ ├─SystemTenantBill.php Tenant billing
│ │ ├─SystemUser.php Tenant members
│ │ ├─SystemUserRuid.php Member login IDs
│ │ ├─SystemUserRelation.php Tenant relationships
│ │ ├─BaseController.php Base controller
│ │ ├─BaseModel.php Base model
│ │ ├─AdminController.php Admin base controller
│ │ ├─ApiController.php API base controller
│ │ ├─TenantController.php Tenant base controller
│ │ ├─WebController.php Web base controller
│ │ └─... Other system directories
├─public Public web directory (exposed)
│ ├─static Module‑specific static files (writable, customizable)
│ │ ├─module_name Matches app/module_name
│ │ │ ├─logo.png Default logo
│ │ │ └─... Additional resources
│ ├─res Local resource upload directory (writable)
│ └─install Installation script (remove after use)
├─platform SAPI++ management platform
├─extend Extension libraries
├─runtime Runtime directory (writable)
├─vendor Composer libraries
├─.example.env Example environment file
├─composer.json Composer definition
├─LICENSE.txt License file
├─README.md Readme
└─think CLI entry pointSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Architects Alliance
Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
