PHP code example of marcw / validator
1. Go to this page and download the library: Download marcw/validator 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/ */
marcw / validator example snippets
namespace AppBundle\Entity;
use MarcW\Validator\Constraints as Assert;
class User
{
/**
* The username is used to attribute a subdomain or a subfolder to the user like:
* https://username.acme.com or https://acme.com/username
* @Assert\Subdomain
* @Assert\Username
*/
private $username;
/**
* @Assert\GoogleAnalytics
*/
private $googleAnalytics;
/**
* @Assert\HTMLColor
*/
private $backgroundColor;
}
class Message
{
/**
* This value must fit in 2 SMS messages.
*
* @Assert\SmsMessage(max=2)
*/
private $body;
}