Configuration
SocialApparatus is highly configurable through environment variables and config files. This guide covers all the settings you'll need to customize for your community.
Environment Configuration
The .env file in your project root contains all sensitive configuration. Never commit this file to version control.
Application Settings
# Application name displayed throughout the site
APP_NAME="Your Community Name"
# Environment: local, staging, production
APP_ENV=production
# Generate with: php artisan key:generate
APP_KEY=base64:your-generated-key
# NEVER enable in production
APP_DEBUG=false
# Your community's URL (no trailing slash)
APP_URL=https://your-community.com
# Default timezone
APP_TIMEZONE=America/New_York
# Default locale
APP_LOCALE=en
Database Configuration
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=socialapparatus
DB_USERNAME=your_username
DB_PASSWORD=your_secure_password
# Optional: Separate read/write connections for scaling
DB_READ_HOST=read-replica.your-server.com
DB_WRITE_HOST=primary.your-server.com
Cache Configuration
# Options: file, redis, memcached, database
CACHE_DRIVER=redis
# Redis configuration
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
# Cache prefix to avoid collisions
CACHE_PREFIX=socialapparatus
Performance Tip: Use Redis for both cache and sessions in production. It significantly improves performance over file-based storage.
Session Configuration
# Options: file, cookie, database, redis
SESSION_DRIVER=redis
# Session lifetime in minutes
SESSION_LIFETIME=120
# Encrypt session data
SESSION_ENCRYPT=true
# Session cookie name
SESSION_COOKIE=socialapparatus_session
Queue Configuration
# Options: sync, database, redis, sqs
QUEUE_CONNECTION=redis
# For database queue driver
# Run: php artisan queue:table && php artisan migrate
Mail Configuration
# Options: smtp, mailgun, ses, postmark, log
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=your-smtp-user
MAIL_PASSWORD=your-smtp-password
MAIL_ENCRYPTION=tls
# From address for outgoing emails
MAIL_FROM_ADDRESS="noreply@your-community.com"
MAIL_FROM_NAME="${APP_NAME}"
File Storage
# Options: local, s3, spaces (DigitalOcean)
FILESYSTEM_DISK=local
# For S3 or S3-compatible storage
AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket
AWS_URL=https://your-bucket.s3.amazonaws.com
Community Settings
These settings are found in config/community.php:
<?php
return [
/*
|--------------------------------------------------------------------------
| Community Name & Branding
|--------------------------------------------------------------------------
*/
'name' => env('COMMUNITY_NAME', 'SocialApparatus'),
'tagline' => env('COMMUNITY_TAGLINE', 'Build thriving communities'),
'logo' => env('COMMUNITY_LOGO', '/images/logo.svg'),
/*
|--------------------------------------------------------------------------
| Registration Settings
|--------------------------------------------------------------------------
*/
'registration' => [
'enabled' => env('REGISTRATION_ENABLED', true),
'require_email_verification' => env('REQUIRE_EMAIL_VERIFICATION', true),
'require_approval' => env('REQUIRE_ADMIN_APPROVAL', false),
'invite_only' => env('INVITE_ONLY', false),
],
/*
|--------------------------------------------------------------------------
| Content Settings
|--------------------------------------------------------------------------
*/
'content' => [
'max_post_length' => env('MAX_POST_LENGTH', 10000),
'max_comment_length' => env('MAX_COMMENT_LENGTH', 2000),
'allow_html' => env('ALLOW_HTML_CONTENT', false),
'allow_media_embeds' => env('ALLOW_MEDIA_EMBEDS', true),
],
/*
|--------------------------------------------------------------------------
| Upload Limits
|--------------------------------------------------------------------------
*/
'uploads' => [
'max_file_size' => env('MAX_UPLOAD_SIZE', 10240), // KB
'allowed_extensions' => ['jpg', 'jpeg', 'png', 'gif', 'webp', 'pdf'],
'max_avatar_size' => env('MAX_AVATAR_SIZE', 2048), // KB
],
/*
|--------------------------------------------------------------------------
| Moderation
|--------------------------------------------------------------------------
*/
'moderation' => [
'auto_approve_posts' => env('AUTO_APPROVE_POSTS', true),
'spam_filter_enabled' => env('SPAM_FILTER_ENABLED', true),
'profanity_filter' => env('PROFANITY_FILTER', false),
'require_post_approval_for_new_users' => env('NEW_USER_POST_APPROVAL', false),
'new_user_threshold_days' => env('NEW_USER_THRESHOLD', 7),
],
/*
|--------------------------------------------------------------------------
| Features Toggle
|--------------------------------------------------------------------------
*/
'features' => [
'groups' => env('FEATURE_GROUPS', true),
'messaging' => env('FEATURE_MESSAGING', true),
'notifications' => env('FEATURE_NOTIFICATIONS', true),
'reactions' => env('FEATURE_REACTIONS', true),
'bookmarks' => env('FEATURE_BOOKMARKS', true),
'following' => env('FEATURE_FOLLOWING', true),
'badges' => env('FEATURE_BADGES', true),
'leaderboard' => env('FEATURE_LEADERBOARD', false),
],
];
User Roles & Permissions
Configure roles in config/permissions.php:
<?php
return [
'roles' => [
'admin' => [
'label' => 'Administrator',
'permissions' => ['*'], // All permissions
],
'moderator' => [
'label' => 'Moderator',
'permissions' => [
'posts.edit',
'posts.delete',
'comments.edit',
'comments.delete',
'users.warn',
'users.mute',
'reports.view',
'reports.resolve',
],
],
'member' => [
'label' => 'Member',
'permissions' => [
'posts.create',
'posts.edit.own',
'posts.delete.own',
'comments.create',
'comments.edit.own',
'comments.delete.own',
'messages.send',
'profile.edit',
],
],
'guest' => [
'label' => 'Guest',
'permissions' => [
'posts.view',
'comments.view',
'profiles.view',
],
],
],
];
Rate Limiting
Configure rate limits in config/rate-limits.php:
<?php
return [
'api' => [
'requests_per_minute' => env('API_RATE_LIMIT', 60),
],
'posts' => [
'per_hour' => env('POSTS_PER_HOUR', 10),
'per_day' => env('POSTS_PER_DAY', 50),
],
'comments' => [
'per_minute' => env('COMMENTS_PER_MINUTE', 5),
'per_hour' => env('COMMENTS_PER_HOUR', 60),
],
'messages' => [
'per_minute' => env('MESSAGES_PER_MINUTE', 10),
'per_hour' => env('MESSAGES_PER_HOUR', 100),
],
'login_attempts' => [
'max_attempts' => env('LOGIN_MAX_ATTEMPTS', 5),
'lockout_minutes' => env('LOGIN_LOCKOUT_MINUTES', 15),
],
];
Notifications
Configure notification channels in config/notifications.php:
<?php
return [
'channels' => [
'database' => true,
'mail' => true,
'broadcast' => env('BROADCAST_NOTIFICATIONS', false),
'slack' => env('SLACK_WEBHOOK_URL', null),
],
'events' => [
'new_follower' => ['database', 'mail'],
'new_comment' => ['database', 'mail'],
'mention' => ['database', 'mail'],
'post_liked' => ['database'],
'message_received' => ['database', 'mail'],
'group_invite' => ['database', 'mail'],
],
// Allow users to customize their preferences
'user_configurable' => true,
];
Caching Configuration
Optimize performance with proper caching in production:
# Cache configuration
php artisan config:cache
# Cache routes
php artisan route:cache
# Cache views
php artisan view:cache
# Cache events
php artisan event:cache
Remember: After changing
.env or config files in production, run php artisan config:cache to apply changes.
Environment-Specific Files
You can create environment-specific configuration:
.env.local- Local development.env.staging- Staging environment.env.production- Production (copy to.env)
Configuration Validation
Verify your configuration is correct:
# Check database connection
php artisan db:show
# Check mail configuration
php artisan tinker
>>> Mail::raw('Test', fn($m) => $m->to('test@example.com'));
# Check queue configuration
php artisan queue:work --once
# Check all configurations
php artisan about