You can validate the social profile link by using of this package.
You can install the package via composer:
composer require ageekdev/laravel-social-link-validator
Platform Name | slug |
---|---|
Line | line |
Youtube | youtube |
We can use as validation rule to validate in Request.
$validated = $request->validate([
'link' => 'social_link'
]);
Validate with platform slug
$validated = $request->validate([
'facebook_link' => 'social_link:facebook'
]);
To Check Platform of URL
use AgeekDev\SocialLinkValidator\Facades\SocialLinkValidator;
$platform = SocialLinkValidator::guess($link);
To Validate of URL of platform
use AgeekDev\SocialLinkValidator\Facades\SocialLinkValidator;
$platform = SocialLinkValidator::guess($url);
if ($platform) {
$isValid = SocialLinkValidator::driver($platform)->isValid($url);
}
composer test
Please create PR or issue for it if it does not already exist.
- create new platform class in
src/Validators/Platforms
folder. - add new class in
config/social-link-validator.php
. - Then PR you code for review.
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
This package contains code copied from Social Validate
GPL-3.0 license. Please see License File for more information.