ageekdev / laravel-social-link-validator
To validate the social profile link
v1.0.1
2024-04-08 04:48 UTC
Requires
- php: ^8.0
- illuminate/support: ^9.0|^10.0|^11.0
Requires (Dev)
- laravel/pint: ^1.10
- nunomaduro/collision: ^6.0|^7.0|^8.0
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^7.0|^8.0
- pestphp/pest: ^1.0|^2.0
- pestphp/pest-plugin-laravel: ^1.4|^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- roave/security-advisories: dev-latest
README
You can validate the social profile link by using of this package.
Installation
You can install the package via composer:
composer require ageekdev/laravel-social-link-validator
Supported Platforms
Usage
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); }
Testing
composer test
Request or add new platform
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.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
This package contains code copied from Social Validate
License
GPL-3.0 license. Please see License File for more information.