O'Reilly logo

PHP Application Development with NetBeans Beginner's Guide by M A Hossain Tonu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating the ValidatorService class

We will keep some validation constants in the class itself, and the class will use My\Service as its namespace. Follow these steps to create the ValidatorService class:

  1. Create a new directory named Service under your project directory. The Service classes will be inside this directory.
  2. Create a new PHP file inside the Service directory named ValidatorService.php, and type in the following class:
    <?php namespace My\Service; use My\Dao\UserDao; class ValidatorService { private $values = array(); private $errors = array(); public $statusMsg = null; public $num_errors; const NAME_LENGTH_MIN = 5; const NAME_LENGTH_MAX = 100; const PASS_LENGTH_MIN = 8; const PASS_LENGTH_MAX = 32; public function __construct() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required