1. Go to this page and download the library: Download unwahas/broadcast library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
unwahas / broadcast example snippets
namespace App\Http\Controllers\Experiment;
use App\Http\Controllers\Controller;
use Unwahas\Broadcast\Services\RabbitMQService;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class BroadcastController extends Controller
{
public function __construct(
protected RabbitMQService $rabbitMQService
) {}
public function sendData(Request $request)
{
$validated = $request->validate([
'email' => 'r_depan' => $validated['gelar_depan'],
'gelar_belakang' => $validated['gelar_belakang'],
'sent_at' => now()->toDateTimeString(),
], from: 'sikawan');
return response()->json([
'status' => 'success',
'message' => 'Data broadcasted successfully!',
]);
}
}
bash
# Menjalankan seluruh antrean yang terdaftar
php artisan rabbitmq:consume
# Menjalankan sender tertentu saja
php artisan rabbitmq:consume --from=sikawan
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.