PHP code example of pouya1364 / probabilistic-laravel
1. Go to this page and download the library: Download pouya1364/probabilistic-laravel 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/ */
pouya1364 / probabilistic-laravel example snippets
use ProbabilisticLaravel\Facades\Probabilistic;
$emails = Probabilistic::bloomFilter('emails_seen');
$emails->add('[email protected]');
if ($emails->mightContain('[email protected]')) {
// probably seen before
}
Probabilistic::hyperLogLog('unique_visitors')->add($visitorId);
$estimate = Probabilistic::hyperLogLog('unique_visitors')->estimate();
use ProbabilisticLaravel\ProbabilisticManager;
final class SignupController
{
public function __construct(private readonly ProbabilisticManager $probabilistic) {}
public function store(): void
{
$this->probabilistic->bloomFilter('emails_seen')->add(/* ... */);
}
}