- Platform: YouTube
- Channel/Creator: Code With ERaufi
- Duration: 00:43:53
- Release Date: Aug 19, 2024
- Video Link: https://www.youtube.com/watch?v=Iuq6jME4ft8
Disclaimer: This is a personal summary and interpretation based on a YouTube video. It is not official material and not endorsed by the original creator. All rights remain with the respective creators.
This document summarizes the key takeaways from the video. I highly recommend watching the full video for visual context and coding demonstrations.
- I summarize key points to help you learn and review quickly.
- Simply click on
Ask AIlinks to dive into any topic you want.
Teach Me: 5 Years Old | Beginner | Intermediate | Advanced | (reset auto redirect)
Learn Differently: Analogy | Storytelling | Cheatsheet | Mindmap | Flashcards | Practical Projects | Code Examples | Common Mistakes
Check Understanding: Generate Quiz | Interview Me | Refactor Challenge | Assessment Rubric | Next Steps
- Summary: Start by creating a new Laravel project using Composer, then navigate into the project directory.
- Key Takeaway/Example: Use the command to install:
Then change directory:
composer create-project laravel/laravel laravel-reverb
cd laravel-reverb. - Link for More Details: Ask AI: Setting Up Laravel Project Locally
- Summary: Install Laravel Broadcasting from the documentation, confirm installation of Reverb and Node dependencies.
- Key Takeaway/Example: Run:
Answer yes to prompts for Reverb and Node setup.
composer require laravel/broadcasting
- Link for More Details: Ask AI: Installing Broadcasting and Reverb
- Summary: Install authentication scaffolding using Breeze with Bootstrap stack.
- Key Takeaway/Example: Commands include:
Replace files if prompted.
composer require laravel/breeze --dev php artisan breeze:install npm install npm run dev
- Link for More Details: Ask AI: Setting Up Authentication
- Summary: Update .env for MySQL database, run migrations to set up the database.
- Key Takeaway/Example: In .env, set
DB_CONNECTION=mysqlandDB_DATABASE=laravel_reverb. Then:Confirm database creation if prompted.php artisan migrate
- Link for More Details: Ask AI: Database Configuration and Migration
- Summary: Create a public event, implement broadcasting, set up listener in welcome.blade.php, and test by triggering the event.
- Key Takeaway/Example: Create event:
php artisan make:event PublicEvent. In event class:In welcome.blade.php:implements ShouldBroadcast public function broadcastOn(): array { return [new Channel('test-channel')]; } public function broadcastWith(): array { return ['message' => $this->message]; }
Trigger via route:setTimeout(() => { window.Echo.channel('test-channel') .listen('PublicEvent', (e) => { console.log(e); }); }, 500);
event(new PublicEvent('Hello World'));. Runnpm run build,php artisan reverb:start,php artisan queue:work. - Link for More Details: Ask AI: Creating and Testing Public Event
- Summary: Create a private event, configure channel authorization, update listener for private channel, and test.
- Key Takeaway/Example: Create event:
php artisan make:event PrivateEvent. In event:In channels.php:implements ShouldBroadcast public function broadcastOn(): array { return [new PrivateChannel('channel.user.' . $this->userId)]; } public function broadcastWith(): array { return [$this->data]; }
In welcome.blade.php:Broadcast::channel('channel.user.{id}', function ($user, $id) { return $user->id === $id; });
Trigger:window.Echo.private(`channel.user.${auth().id}`) .listen('PrivateEvent', (e) => { console.log(e); });
event(new PrivateEvent('Private Message', 1));. Ensure logged in for testing. - Link for More Details: Ask AI: Creating and Testing Private Event
- Summary: Zip the project, upload to VPS public_html, unzip, and set up.
- Key Takeaway/Example: Use FTP or Termius to upload zip to /home/domain/public_html, then:
unzip laravel-reverb.zip
- Link for More Details: Ask AI: Deploying to VPS
- Summary: Create database and user in cPanel, assign privileges.
- Key Takeaway/Example: In cPanel, create database 'laravel_reverb', add user with all privileges.
- Link for More Details: Ask AI: Database Setup on Server
- Summary: Update .env with database credentials, app URL, run migrations and optimize.
- Key Takeaway/Example: Set
APP_URL=https://domain.com, update DB details. Then:php artisan migrate php artisan optimize:clear
- Link for More Details: Ask AI: Configuring .env and Running Migrations on Server
- Summary: Add .htaccess file to public_html to rewrite URLs without /public.
- Key Takeaway/Example: Upload .htaccess with rewrite rules to root.
- Link for More Details: Ask AI: Removing /public from URL
- Summary: Open port 8080 in WHM firewall for TCP in/out.
- Key Takeaway/Example: In WHM > ConfigServer Security & Firewall > Firewall Configuration, add ,8080 to TCP_IN and TCP_OUT, then change and restart.
- Link for More Details: Ask AI: Opening Firewall Ports
- Summary: Issue trusted SSL from ZeroSSL, install in WHM using certificate, key, and CA bundle files uploaded to server.
- Key Takeaway/Example: Avoid self-signed certs. Upload files to storage/app/ssl, then in WHM > SSL/TLS > Install an SSL Certificate, paste contents manually for domain.
- Link for More Details: Ask AI: Configuring SSL Certificate
- Summary: Update .env and config/reverb.php with domain, https scheme, and TLS file paths.
- Key Takeaway/Example: In .env:
In config/reverb.php: Add to 'tls' array:
REVERB_HOST=domain.com REVERB_SCHEME=https REVERB_TLS_CERT_PATH=/home/domain/public_html/laravel-reverb/storage/app/ssl/certificate.crt REVERB_TLS_KEY_PATH=/home/domain/public_html/laravel-reverb/storage/app/ssl/private.key REVERB_TLS_CA_BUNDLE=/home/domain/public_html/laravel-reverb/storage/app/ssl/ca_bundle.crt
'local_cert' => env('REVERB_TLS_CERT_PATH'), 'local_pk' => env('REVERB_TLS_KEY_PATH'), 'cafile' => env('REVERB_TLS_CA_BUNDLE'),
- Link for More Details: Ask AI: Updating Reverb Config for HTTPS
- Summary: Build assets, start Reverb and queue worker on server.
- Key Takeaway/Example:
npm run build php artisan reverb:start php artisan queue:work
- Link for More Details: Ask AI: Running Services on Server
- Summary: Test events on server, troubleshoot connection failures by accessing ws://domain:8080 or updating Apache config.
- Key Takeaway/Example: For errors, curl ws://domain:8080 to check, or add to WHM Apache pre-virtualhost include:
Then restart Apache.
# Proxy for WebSocket ProxyPass /app/ ws://localhost:8080/app/ ProxyPassReverse /app/ ws://localhost:8080/app/
- Link for More Details: Ask AI: Testing and Troubleshooting
About the summarizer
I'm Ali Sol, a Backend Developer. Learn more:
- Website: alisol.ir
- LinkedIn: linkedin.com/in/alisolphp