cimembership/cimembership
Composer 安装命令:
composer require cimembership/cimembership
包简介
CodeIgniter 4 Membership Management System - Base Platform
关键字:
README 文档
README
A modern, secure membership management system built with CodeIgniter 4.
Features
- Modern CodeIgniter 4 - Built on the latest CodeIgniter 4.x framework
- PHP 8.1+ - Uses modern PHP features for better performance and security
- Secure Authentication - Password hashing with bcrypt, CSRF protection, rate limiting
- OAuth Social Login - Facebook, Google, GitHub, LinkedIn, Twitter, Microsoft
- Role-Based Access Control - Flexible user groups and permissions
- User Profiles - Complete user profile management with avatar upload
- Admin Dashboard - Beautiful dashboard with user management
- Email Activation - Optional email verification for new accounts
- Password Reset - Secure password reset via email
- API Ready - RESTful API with API key authentication
- CLI Installer - Modern command-line installation
- Upgrade Path - Migrate from CI3 CIMembership seamlessly
Requirements
- PHP 8.1 or higher
- MySQL 5.7+ or MariaDB 10.3+
- Composer
- Web server (Apache/Nginx)
Installation
Quick Start
# Install via Composer composer create-project cimembership/cimembership cimembership cd cimembership # Run the installer php spark install:app
Manual Installation
- Download the latest release
- Extract to your web server directory
- Run
composer install - Copy
.env.exampleto.envand configure - Run
php spark migrate - Create an admin user
For detailed instructions, see INSTALL.md.
Upgrading from v3 (CI3)
If you're upgrading from CIMembership v3 (CodeIgniter 3):
# After installing v4, run the upgrade command
php spark upgrade:fromv3
This will migrate your users, groups, profiles, and settings from CI3 to CI4.
See UPGRADE.md for detailed upgrade instructions.
Directory Structure
cimembership/
├── app/
│ ├── Commands/ # CLI commands (installer, upgrade)
│ ├── Config/ # Configuration files
│ ├── Controllers/ # Base controllers
│ ├── Database/
│ │ └── Migrations/ # Database migrations
│ ├── Filters/ # Authentication & security filters
│ ├── Libraries/ # Core libraries
│ │ ├── Auth/ # Authentication classes
│ │ ├── Captcha/ # Captcha handling
│ │ └── OAuth/ # OAuth providers
│ ├── Models/ # Database models
│ └── Modules/
│ ├── Admin/ # Admin module (Dashboard, Users, Settings)
│ └── Auth/ # Auth module (Login, Register, OAuth)
├── public/ # Web root
├── tests/ # Unit tests
├── writable/ # Cache, logs, uploads
├── composer.json
└── spark # CLI entry point
Configuration
Environment Variables
Copy .env.example to .env and configure:
cp .env.example .env
Required Settings
# Environment (production for live sites) CI_ENVIRONMENT = production # Database (required) database.default.hostname = localhost database.default.database = your_database_name database.default.username = your_database_user database.default.password = your_secure_password database.default.DBPrefix = ci_ # Application URL (required) app.baseURL = 'https://yourdomain.com/' app.timezone = 'UTC'
Optional Settings
# Email (for user activation, password reset) email.protocol = smtp email.SMTPHost = smtp.yourdomain.com email.SMTPUser = noreply@yourdomain.com email.SMTPPass = your_email_password email.SMTPPort = 587 email.SMTPCrypto = tls # OAuth - Facebook cimembership.oauth.facebook.enabled = true cimembership.oauth.facebook.clientId = your_facebook_app_id cimembership.oauth.facebook.clientSecret = your_facebook_app_secret # OAuth - Google cimembership.oauth.google.enabled = true cimembership.oauth.google.clientId = your_google_client_id cimembership.oauth.google.clientSecret = your_google_client_secret # reCAPTCHA (for spam protection) cimembership.recaptcha.enabled = true cimembership.recaptcha.siteKey = your_recaptcha_site_key cimembership.recaptcha.secretKey = your_recaptcha_secret_key
OAuth Configuration
Enable OAuth providers in Admin > Settings > OAuth:
- Go to Admin Dashboard
- Navigate to Settings > OAuth
- Enter your Client ID and Client Secret for each provider
- Enable the providers you want to use
Note: Configure redirect URLs in your OAuth app:
- Facebook:
https://example.com/auth/oauth/facebook/callback - Google:
https://example.com/auth/oauth/google/callback - GitHub:
https://example.com/auth/oauth/github/callback - LinkedIn:
https://example.com/auth/oauth/linkedin/callback
CLI Commands
# Installation php spark install:app # Upgrade from v3 php spark upgrade:fromv3 --source-db=old_cimembership_db --source-prefix=ci_ # Database php spark migrate php spark migrate:rollback php spark migrate:refresh # Seeds php spark db:seed UserSeeder
Security Features
- Password Hashing: bcrypt with cost factor 12
- CSRF Protection: All forms protected by default
- Rate Limiting: Login attempts limited per IP
- Session Security: Regenerated on login
- XSS Protection: Output escaping by default
- SQL Injection Prevention: Parameterized queries
- Password Strength: Configurable minimum requirements
API Usage
CIMembership v4 includes a RESTful API:
# Get API key from Admin panel curl -H "X-API-Key: your-api-key" \ https://example.com/api/users # Create user curl -X POST \ -H "X-API-Key: your-api-key" \ -H "Content-Type: application/json" \ -d '{"username":"john","email":"john@example.com","password":"secret"}' \ https://example.com/api/users
Troubleshooting
Common Issues
Installation fails with database error:
- Check MySQL credentials in
.env - Ensure database exists and user has privileges
- Check MySQL version (5.7+ required)
OAuth not working:
- Verify redirect URLs are configured correctly
- Check Client ID and Secret are correct
- Ensure callback URLs are HTTPS in production
Emails not sending:
- Configure SMTP settings in
.env - Check server allows outgoing SMTP connections
- Review logs in
writable/logs/
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
- Code follows PSR-12 coding standards
- All tests pass
- Documentation is updated
License
CIMembership is open-source software licensed under the MIT license.
Support
- Documentation: https://github.com/cimembership/cimembership/blob/main/README.md
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Note: This is a complete rewrite from the original CIMembership v3. While we've provided an upgrade path, please backup your data before migrating.
cimembership/cimembership 适用场景与选型建议
cimembership/cimembership 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Authentication」 「oauth」 「codeigniter」 「auth」 「base」 「platform」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cimembership/cimembership 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cimembership/cimembership 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cimembership/cimembership 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WeChat OAuth SDK
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
GraphQL authentication for your headless Craft CMS applications.
Ory-Hydra OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Library for ORCID web services
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 39
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-09