diff --git a/src/ncc/Utilities/Validate.php b/src/ncc/Utilities/Validate.php index 1ca050d..1adc283 100644 --- a/src/ncc/Utilities/Validate.php +++ b/src/ncc/Utilities/Validate.php @@ -108,4 +108,25 @@ return true; } + + /** + * Validates if the package name is valid + * + * @param $input + * @return bool + */ + public static function PackageName($input): bool + { + if($input == null) + { + return false; + } + + if((bool)preg_match("/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/", $input) == false) + { + return false; + } + + return true; + } } \ No newline at end of file