# Validation

{% hint style="danger" %}
This package is outdated and the documentation as well
{% endhint %}

## Email

An easy no-hassle way to validate email addresses. It validates on basic faults like not a valid format, but it also checks if the domain can be mailed.

```php
validate_email($email, $debug = false)
```

Example:

```php
use NanFunctions\Validate;

$validator = new Validate();
$valid = $validator->validate_email('info@example.com');
echo $valid ? 'Valid' : 'Invalid';
```

Tip: Set the debug paramater to true to see what the email fails on

## Phone

An easy no-hassle way to validate a phone number.

```php
validate_phone_number($email, $country_code= false)
```

Example:

```php
use NanFunctions\Validate;

$validator = new Validate();
// First parameter is the phone number. Second paramater is if country code is allow
$valid = $validator->validate_phone_number('+31612345678', true);

echo $valid ? 'Valid' : 'Invalid';
```

Tip: Set the debug paramater to true to allow the phone number to have a country code like `+31`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://composer.notanumber.digital/php-general-package/validation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
