# Autonomous College Management System

A comprehensive CRM automation system with advanced UI for academic institution management.

## 🚀 Quick Start

### Prerequisites
- PHP 7.4+ (Recommended: PHP 8.1+)
- MySQL 5.7+ (Recommended: MySQL 8.0+)
- Apache 2.4+ or Nginx 1.18+
- Composer 2.0+

### Installation

1. **Clone the repository**
   ```bash
   git clone https://github.com/autonomous-college/crm-system.git
   cd crm-system
   ```

2. **Install dependencies**
   ```bash
   composer install --no-dev --optimize-autoloader
   ```

3. **Setup database**
   ```bash
   mysql -u root -p
   CREATE DATABASE autonomous_college CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
   mysql -u root -p autonomous_college < autonomous_college.sql
   ```

4. **Configure environment**
   ```bash
   cp environment.example .env
   # Edit .env with your database credentials
   ```

5. **Set permissions**
   ```bash
   chmod -R 755 .
   chmod -R 777 uploads/ logs/ cache/
   ```

6. **Access the application**
   ```
   http://localhost/Autonomous-College
   ```

## 📋 Features

### Core Modules
- **Academic Structure Management**
  - Colleges, Courses, Subjects
  - Branches, Categories
  - Academic Years, Semesters

- **Student Management**
  - Student Registration
  - Academic Records
  - Attendance Tracking

- **Staff Management**
  - Staff Registration
  - Role Assignment
  - Permission Management

- **Examination System**
  - Exam Scheduling
  - Hall Allocation
  - Mark Entry
  - Result Processing

### Advanced Features
- **Bulk Operations**
  - CSV/Excel Import/Export
  - Bulk Upload with Validation
  - Error Reporting

- **Filtering & Search**
  - Advanced Filters
  - Real-time Search
  - Export Filtered Data

- **Audit Logging**
  - Complete Action Tracking
  - User Activity Monitoring
  - Data Change History

- **Professional UI**
  - Modern Bootstrap 5 Design
  - Responsive Layout
  - Interactive Components
  - Toast Notifications

## 📁 Project Structure

```
Autonomous-College/
├── api/                    # API endpoints
│   ├── subjects/          # Subjects API
│   ├── courses/           # Courses API
│   ├── colleges/          # Colleges API
│   └── helper/            # Helper functions
├── assets/                # Static assets
├── config/                # Configuration files
├── uploads/               # File uploads
├── logs/                  # Application logs
├── master-*.php          # Main management pages
├── composer.json         # Dependencies
├── VERSION_INFO.md       # Version information
├── INSTALLATION.md       # Installation guide
├── DEPLOYMENT.md         # Deployment guide
└── README.md            # This file
```

## 🔧 Configuration

### Environment Variables
Copy `environment.example` to `.env` and configure:

```env
# Database
DB_HOST=localhost
DB_NAME=autonomous_college
DB_USERNAME=root
DB_PASSWORD=

# Application
APP_ENV=production
APP_DEBUG=false
APP_NAME="Autonomous College"
```

### PHP Configuration
Required PHP extensions:
- PDO, PDO_MySQL
- JSON, MBString
- FileInfo, OpenSSL

Optional extensions:
- GD, ImageMagick
- ZIP, cURL, Intl

## 📊 API Documentation

### Subjects API
- `GET /api/subjects/read.php` - List subjects
- `POST /api/subjects/create.php` - Create subject
- `POST /api/subjects/update.php` - Update subject
- `POST /api/subjects/delete.php` - Delete subject
- `GET /api/subjects/export.php` - Export subjects
- `POST /api/subjects/bulk-upload.php` - Bulk upload

### Courses API
- `GET /api/courses/read.php` - List courses
- `POST /api/courses/create.php` - Create course
- `POST /api/courses/update.php` - Update course
- `POST /api/courses/delete.php` - Delete course

### Colleges API
- `GET /api/colleges/read.php` - List colleges
- `POST /api/colleges/create.php` - Create college
- `POST /api/colleges/update.php` - Update college
- `POST /api/colleges/delete.php` - Delete college

## 🚀 Deployment

### Production Deployment
1. **Server Setup**
   ```bash
   sudo apt update
   sudo apt install php8.1 php8.1-mysql php8.1-mbstring apache2 mysql-server composer
   ```

2. **Application Deployment**
   ```bash
   composer install --no-dev --optimize-autoloader --classmap-authoritative
   ```

3. **Security Configuration**
   ```bash
   chmod -R 755 .
   chmod -R 777 uploads/ logs/ cache/
   chmod 600 .env
   ```

4. **Web Server Configuration**
   - Configure Apache/Nginx virtual host
   - Enable SSL certificate
   - Set security headers

See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed instructions.

## 🔍 Version Information

### Current Version: 1.2.0

### System Requirements
- **PHP**: 7.4+ (Recommended: 8.1+)
- **MySQL**: 5.7+ (Recommended: 8.0+)
- **Apache**: 2.4+ or Nginx 1.18+
- **Composer**: 2.0+

### Dependencies
- **PhpSpreadsheet**: ^1.29 (for Excel support)
- **jQuery**: 3.6+
- **Bootstrap**: 5.3+
- **DataTables**: 1.13+

See [VERSION_INFO.md](VERSION_INFO.md) for complete version details.

## 🛠️ Development

### Development Setup
```bash
# Install development dependencies
composer install

# Run tests
composer test

# Static analysis
composer analyze

# Code style check
composer cs-check
```

### Code Standards
- PSR-12 coding standard
- PHPDoc comments
- Unit tests for critical functions
- Static analysis with PHPStan

## 📝 Documentation

- [VERSION_INFO.md](VERSION_INFO.md) - Version and compatibility information
- [INSTALLATION.md](INSTALLATION.md) - Detailed installation guide
- [DEPLOYMENT.md](DEPLOYMENT.md) - Production deployment guide
- [package-versions.json](package-versions.json) - Complete package versions
- [requirements.txt](requirements.txt) - System requirements

## 🔧 Troubleshooting

### Common Issues

1. **Composer Memory Error**
   ```bash
   php -d memory_limit=-1 /usr/local/bin/composer install
   ```

2. **Database Connection Error**
   - Check MySQL service status
   - Verify credentials in `.env`
   - Ensure database exists

3. **File Upload Issues**
   - Check PHP upload limits
   - Verify directory permissions
   - Check file size limits

4. **Permission Issues**
   ```bash
   sudo chown -R www-data:www-data .
   chmod -R 755 .
   chmod -R 777 uploads/ logs/ cache/
   ```

### Version Check
Run the version check script:
```bash
php check-versions.php
```

## 📞 Support

- **Documentation**: See individual `.md` files
- **Issues**: Check error logs in `logs/` directory
- **Database**: Check `autonomous_college.sql` for schema
- **API**: Check `api/` directory for endpoints

## 📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

## 🤝 Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

## 📈 Roadmap

### Version 1.3.0 (Planned)
- Enhanced reporting system
- Advanced analytics dashboard
- Mobile app integration
- API rate limiting

### Version 1.4.0 (Future)
- Multi-tenant support
- Advanced workflow automation
- Machine learning integration
- Real-time notifications

---

**Autonomous College Management System** - Empowering educational institutions with modern technology.
