HTTP Basic Authentication middleware comes with simple PDO authenticator. It can be used to authenticate users from database. Authenticator assumes username and hashed password are stored in database. Default name for table is
users. Default column names for username and has are
hash. Column and table names can also be set in options. Hash must be created with password_hash() function. Simplest possible table to store user data looks something like this.
CREATE TABLE users ( user VARCHAR(32) NOT NULL, hash VARCHAR(255) NOT NULL )
There are two kinds of people. Those who like their accessors and mutators to start with
set. This is also what PHP-FIG seems to suggest.
$unicorn = new Unicorn(); $unicorn->setBirthday("1930-24-12")->setColor("rainbow"); print $unicorn->getAge();
It works well with IDE autocompletion. It is also easy to write API documentation using PHPDoc. Then there are those like me who prefer to leave
$unicorn = new Unicorn(); $unicorn->birthday("1930-24-12")->color("rainbow"); print $unicorn->age();
Or sometimes even access them as properties.
$unicorn = new Unicorn(); $unicorn->birthday = "1930-24-12"; $unicorn->color = "rainbow"; print $unicorn->age;