PHP code example of mischasigtermans / laravel-sift
1. Go to this page and download the library: Download mischasigtermans/laravel-sift 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/ */
mischasigtermans / laravel-sift example snippets
use MischaSigtermans\Sift\Facades\Sift;
// Extract business domains (filters public providers by default)
Sift::domain('[email protected]'); // 'company.com'
Sift::domain('[email protected]'); // null (filtered)
// Check if email is business or personal
Sift::isBusiness('[email protected]'); // true
Sift::isBusiness('[email protected]'); // false
// Validate in form requests
$request->validate([
'email' => ['
// config/sift.php
return [
// Add extra domains to filter (on top of package defaults)
'additional_domains' => [
'competitor.com',
'internal-tool.io',
],
// Whitelist specific defaults (allow them as business emails)
'exclude_default_domains' => [
'protonmail.com', // Allow privacy-focused provider
'fastmail.com',
],
];
use MischaSigtermans\Sift\DefaultDomains;
// Get the full list of 100+ default domains
DefaultDomains::LIST;
// Or get the merged list (defaults + additional - excluded)
Sift::getCommonDomains();
public function store(Request $request)
{
$request->validate([
'email' => ['' => Sift::domain($request->email),
]);
}
public function emailStats()
{
$emails = User::pluck('email');
return Sift::stats($emails);
// Shows business vs personal breakdown with top company domains
}