#!/bin/bash # Password Generator Installation Script # This script sets up the password generator with i18n support set -e echo "๐Ÿ” Password Generator Installation" echo "==================================" # Check PHP version php_version=$(php -v | head -n1 | cut -d' ' -f2 | cut -d'.' -f1,2) required_version="8.1" if [ "$(printf '%s\n' "$required_version" "$php_version" | sort -V | head -n1)" != "$required_version" ]; then echo "โŒ PHP 8.1+ required (found: $php_version)" exit 1 fi echo "โœ… PHP version: $php_version" # Check if composer is installed if ! command -v composer &> /dev/null; then echo "โŒ Composer not found. Please install Composer first:" echo " https://getcomposer.org/download/" exit 1 fi echo "โœ… Composer found" # Install PHP dependencies echo "" echo "๐Ÿ“ฆ Installing PHP dependencies..." composer install --no-dev --optimize-autoloader # Set up environment file if [ ! -f .env ]; then echo "" echo "โš™๏ธ Setting up environment configuration..." cp .env.example .env echo "โœ… Environment file created (.env)" echo " You can edit this file to customize settings" else echo "โœ… Environment file already exists" fi # Create logs directory and set permissions echo "" echo "๐Ÿ“ Setting up directories..." mkdir -p logs chmod 755 logs echo "โœ… Logs directory created" # Check if pwgen is available (optional) if command -v pwgen &> /dev/null; then echo "โœ… pwgen found (enhanced compatibility enabled)" else echo "โ„น๏ธ pwgen not found (will use PHP fallback)" fi # Test the installation echo "" echo "๐Ÿงช Testing installation..." php -l public/index.php > /dev/null if [ $? -eq 0 ]; then echo "โœ… PHP syntax check passed" else echo "โŒ PHP syntax error found" exit 1 fi # Start the development server echo "" echo "๐Ÿš€ Installation completed successfully!" echo "" echo "To start the development server:" echo " php -S localhost:8080 -t public" echo "" echo "To start with composer:" echo " composer start" echo "" echo "Then visit: http://localhost:8080" echo "" echo "๐Ÿ“š Features:" echo " โ€ข REST API for password generation" echo " โ€ข Multilingual web interface (8 languages)" echo " โ€ข 5 different password generation algorithms" echo " โ€ข Security analysis and entropy calculation" echo " โ€ข Password manager integration examples" echo "" echo "๐Ÿ“– Documentation: http://localhost:8080/docs" echo "๐ŸŒ Supported languages: EN, DE, FR, IT, ES, PT, JA, ZH"