Installation Guide

GitHub

Installation Guide

This guide will walk you through installing Codementor-AI in your Laravel project. The installation process is designed to be simple and automatic.

System Requirements

Minimum Requirements

  • PHP: 8.3 or higher
  • Laravel: 10.0 or higher (for Laravel projects)
  • Composer: 2.0 or higher
  • Memory: 256MB RAM
  • Storage: 50MB free space

Recommended Requirements

  • PHP: 8.4 or higher
  • Laravel: 11.0 or higher
  • Memory: 512MB RAM
  • Storage: 100MB free space
  • Extensions: PDO, JSON, Mbstring, OpenSSL

Installation Methods

Codementor-AI offers different installation options based on your needs:

Full Installation (Recommended)

This is the complete installation that sets up everything you need:

# Navigate to your project root
cd /path/to/your/laravel-project

# Run full installation
./codementor-ai/install.sh --full

This command will:

  • ✅ Detect if you're in a Laravel project
  • ✅ Create appropriate configuration files
  • ✅ Set up Git hooks (pre-commit, pre-push)
  • ✅ Install required Composer dependencies
  • ✅ Configure autoloading
  • ✅ Add Composer scripts
  • ✅ Set up recovery system

Quick Setup

For faster setup with minimal configuration:

# Quick setup (hooks + config only)
./codementor-ai/install.sh --quick

This installs:

  • ✅ Basic configuration
  • ✅ Git hooks
  • ✅ Essential dependencies

Git Hooks Only

If you only want the Git integration:

# Git hooks only
./codementor-ai/install.sh --hooks

This sets up:

  • ✅ Pre-commit hook for quick analysis
  • ✅ Pre-push hook for full analysis
  • ✅ Basic configuration

Manual Installation

For advanced users who want full control:

Step 1: Copy Codementor-AI

# Copy the codementor-ai folder to your project
cp -r /path/to/codementor-ai ./codementor-ai

# Or clone from repository
git clone https://github.com/your-org/codementor-ai.git

Step 2: Install Dependencies

# Install required packages
composer require nikic/php-parser
composer require symfony/console
composer require symfony/finder

Step 3: Configure Autoloading

Add to your composer.json:

{
    "autoload": {
        "psr-4": {
            "CodementorAI\\": "codementor-ai/src/"
        }
    }
}

Step 4: Set Up Git Hooks

# Create hooks directory
mkdir -p .git/hooks

# Copy pre-commit hook
cp codementor-ai/hooks/pre-commit .git/hooks/
chmod +x .git/hooks/pre-commit

# Copy pre-push hook
cp codementor-ai/hooks/pre-push .git/hooks/
chmod +x .git/hooks/pre-push

Verification

After installation, verify everything is working:

# Test the installation
php codementor-ai/cli.php --version

# Run a quick analysis
php codementor-ai/cli.php --quick

# Check configuration
php codementor-ai/cli.php --config

Troubleshooting

Common Issues:

  • Permission Denied: Make sure the install script is executable: chmod +x codementor-ai/install.sh
  • Composer Issues: Run composer dump-autoload after installation
  • Git Hooks Not Working: Ensure hooks are executable and in the correct location

Next Steps

Once installation is complete: