βš™οΈ Configuration Guide

Complete configuration options for ProfileHub

Configuration Overview

ProfileHub provides extensive configuration options to customize the behavior, appearance, and functionality of the user profile management system. Configuration is managed through Laravel's standard configuration files and environment variables.

This guide covers all available configuration options, their purposes, and recommended settings for different use cases.

Configuration Files

πŸ“„ profilehub.php

Main configuration file containing ProfileHub-specific settings, feature toggles, and default values.

Location: config/profilehub.php

🌍 .env Variables

Environment-specific settings that can be configured per deployment without code changes.

Location: .env

πŸ“ Filesystem Config

File upload and storage configuration integrated with Laravel's filesystem configuration.

Location: config/filesystems.php

πŸ” Authentication

User authentication and session management configuration extending Laravel's auth system.

Location: config/auth.php

Main Configuration (profilehub.php)

Core Settings

The main ProfileHub configuration file contains all package-specific settings:

// config/profilehub.php <?php return [ // Profile completion enforcement 'force_profile_update' => env('PROFILEHUB_FORCE_PROFILE_UPDATE', true), // File storage settings 'profile_photo_path' => env('PROFILEHUB_PROFILE_PHOTO_PATH', 'profile-photos'), 'default_avatar' => env('PROFILEHUB_DEFAULT_AVATAR', 'default.png'), // Route configuration 'route_prefix' => env('PROFILEHUB_ROUTE_PREFIX', 'profilehub'), 'admin_prefix' => env('PROFILEHUB_ADMIN_PREFIX', 'admin'), // UI and UX settings 'items_per_page' => env('PROFILEHUB_ITEMS_PER_PAGE', 25), 'enable_registration' => env('PROFILEHUB_ENABLE_REGISTRATION', true), // Security settings 'max_upload_size' => env('PROFILEHUB_MAX_UPLOAD_SIZE', 2048), // KB 'allowed_file_types' => [ 'images' => ['jpg', 'jpeg', 'png', 'gif'], 'documents' => ['pdf', 'doc', 'docx'], ], ];

Configuration Options Reference

force_profile_update boolean

Purpose: Controls whether users are forced to complete their profiles before accessing the application.

Default: true

Environment Variable: PROFILEHUB_FORCE_PROFILE_UPDATE

// When enabled, users with incomplete profiles are redirected to profile completion page 'force_profile_update' => true, // Force completion 'force_profile_update' => false, // Optional completion

profile_photo_path string

Purpose: Defines the directory path for storing user profile photos.

Default: 'profile-photos'

Environment Variable: PROFILEHUB_PROFILE_PHOTO_PATH

// Profile photos will be stored in: storage/app/public/profile-photos/ 'profile_photo_path' => 'profile-photos', // Custom path example 'profile_photo_path' => 'uploads/avatars',

default_avatar string

Purpose: Specifies the default avatar image for users without profile photos.

Default: 'default.png'

Environment Variable: PROFILEHUB_DEFAULT_AVATAR

// Default avatar file should be placed in: public/vendor/profilehub/images/ 'default_avatar' => 'default.png', // Custom default avatar 'default_avatar' => 'custom-avatar.jpg',

route_prefix string

Purpose: Sets the URL prefix for all ProfileHub routes.

Default: 'profilehub'

Environment Variable: PROFILEHUB_ROUTE_PREFIX

// Default: /profilehub/dashboard 'route_prefix' => 'profilehub', // Custom prefix: /users/dashboard 'route_prefix' => 'users', // No prefix: /dashboard 'route_prefix' => '',

max_upload_size integer

Purpose: Maximum file upload size in kilobytes for profile photos and documents.

Default: 2048 (2MB)

Environment Variable: PROFILEHUB_MAX_UPLOAD_SIZE

// 2MB limit 'max_upload_size' => 2048, // 5MB limit 'max_upload_size' => 5120, // 10MB limit 'max_upload_size' => 10240,

Environment Variables

Environment Configuration (.env)

Configure ProfileHub through environment variables for different deployment environments:

# ProfileHub Configuration PROFILEHUB_FORCE_PROFILE_UPDATE=true PROFILEHUB_PROFILE_PHOTO_PATH=profile-photos PROFILEHUB_DEFAULT_AVATAR=default.png PROFILEHUB_ROUTE_PREFIX=profilehub PROFILEHUB_ADMIN_PREFIX=admin PROFILEHUB_ITEMS_PER_PAGE=25 PROFILEHUB_ENABLE_REGISTRATION=true PROFILEHUB_MAX_UPLOAD_SIZE=2048 # File Upload Configuration UPLOAD_MAX_FILESIZE=10M POST_MAX_SIZE=10M MAX_FILE_UPLOADS=20 # Database Configuration DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database DB_USERNAME=your_username DB_PASSWORD=your_password # Mail Configuration (for notifications) MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=your_username MAIL_PASSWORD=your_password MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=noreply@yourapp.com MAIL_FROM_NAME="Your App Name"

File Upload Configuration

πŸ“ File Upload Settings:

ProfileHub integrates with Laravel's file storage system and requires proper configuration for secure file handling.

Storage Configuration

// config/filesystems.php 'disks' => [ 'profilehub' => [ 'driver' => 'local', 'root' => storage_path('app/public/profilehub'), 'url' => env('APP_URL').'/storage/profilehub', 'visibility' => 'public', ], ],

PHP Configuration

Ensure your PHP configuration supports the file sizes you want to allow:

PHP Setting Recommended Value Purpose
upload_max_filesize10MMaximum size of uploaded files
post_max_size10MMaximum size of POST data
max_file_uploads20Maximum number of files per upload
memory_limit256MPHP memory limit
max_execution_time300Script execution timeout

Security Configuration

πŸ”’ Security Considerations

File Type Restrictions

// config/profilehub.php 'allowed_file_types' => [ 'profile_photos' => ['jpg', 'jpeg', 'png', 'gif'], 'documents' => ['pdf', 'doc', 'docx', 'txt'], 'certificates' => ['pdf', 'jpg', 'png'], ], // File size limits per type (in KB) 'file_size_limits' => [ 'profile_photos' => 2048, // 2MB 'documents' => 5120, // 5MB 'certificates' => 3072, // 3MB ],

Performance Configuration

Pagination and Caching

// config/profilehub.php 'performance' => [ // Pagination settings 'items_per_page' => 25, 'max_items_per_page' => 100, // Caching settings 'cache_user_data' => true, 'cache_duration' => 3600, // 1 hour // Query optimization 'eager_load_relationships' => true, 'use_database_indexing' => true, ],

Localization Configuration

Multi-language Support

// config/profilehub.php 'localization' => [ 'default_locale' => 'en', 'supported_locales' => [ 'en' => 'English', 'es' => 'EspaΓ±ol', 'fr' => 'FranΓ§ais', 'de' => 'Deutsch', ], 'fallback_locale' => 'en', ], // Date and time formatting 'date_format' => 'Y-m-d', 'time_format' => 'H:i:s', 'datetime_format' => 'Y-m-d H:i:s',

Email Configuration

Notification Settings

// config/profilehub.php 'email' => [ // Email notifications 'send_welcome_email' => true, 'send_profile_completion_reminder' => true, 'admin_notification_email' => env('ADMIN_EMAIL', 'admin@yourapp.com'), // Email templates 'welcome_template' => 'profilehub.emails.welcome', 'reminder_template' => 'profilehub.emails.profile-reminder', ],

Advanced Configuration

⚠️ Advanced Settings

The following settings should only be modified by experienced developers who understand their implications.

Custom Field Configuration

// config/profilehub.php 'custom_fields' => [ // Field validation rules 'validation_rules' => [ 'text' => 'required|string|max:255', 'email' => 'required|email|max:255', 'number' => 'required|numeric|min:0', 'file' => 'required|file|mimes:pdf,jpg,png|max:2048', ], // Field rendering options 'render_options' => [ 'use_bootstrap_classes' => true, 'add_validation_classes' => true, 'enable_tooltips' => true, ], ],

Configuration Best Practices

βœ… Recommended Practices

πŸ’‘ Configuration Tips