PHP code example of marcel-strahl / temporary-email-validator-bundle

1. Go to this page and download the library: Download marcel-strahl/temporary-email-validator-bundle 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/ */

    

marcel-strahl / temporary-email-validator-bundle example snippets


return [
    // Some other bundles [...]
    MarcelStrahl\TemporaryEmailValidatorSymfony\TemporaryEmailValidatorBundle::class => ['all' => true],  
];

namespace App\Controller;

use MarcelStrahl\TemporaryEmailValidatorSymfony\Validator\IsNotTemporaryEmail;

final class TestDto
{
    /**
    * @IsNotTemporaryEmail 
    */
    private string $email;

    private function __construct(string $email)
    {
        $this->email = $email;
    }

    public static function create(string $email): self
    {
        return new self($email);
    }

    public function getEmail(): string
    {
        return $this->email;
    }
}

     namespace App\Controller;

use MarcelStrahl\TemporaryEmailValidatorSymfony\Validator\IsNotTemporaryEmail;

final class TestDto
{
    #[IsNotTemporaryEmail]
    private string $email;

    private function __construct(string $email)
    {
        $this->email = $email;
    }

    public static function create(string $email): self
    {
        return new self($email);
    }

    public function getEmail(): string
    {
        return $this->email;
    }
}