Skip to content

Commit

Permalink
Releasing 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
technicalguru committed Nov 13, 2020
2 parents 828c8ea + c880899 commit 43f1cd4
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ foreach (Log::get() AS $message) {
Log::clean();
```

## Authentication Helper
A simple authentication helper interface along with a default implementation is provided:

* [TgUtils\Auth\CredentialsProvider](https://github.com/technicalguru/php-utils/blob/src/TgUtils/Auth/CredentialsProvider.php) - Interface to provide username and password to other objects
* [TgUtils\Auth\DefaultCredentialsProvider](https://github.com/technicalguru/php-utils/blob/src/TgUtils/Auth/DefaultCredentialsProvider.php) - Simple default implementation of the interface

## Other Utils
There are some daily tasks that need to be done in applications. The `Utils` class addresses a few of them:

Expand Down
23 changes: 23 additions & 0 deletions src/TgUtils/Auth/CredentialsProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace TgUtils\Auth;

/**
* A helper interface when user credentials are required.
*/
interface CredentialsProvider {

/**
* Returns the username.
* @return string the username
*/
public function getUsername();

/**
* Returns the password.
* @return string the password
*/
public function getPassword();

}

31 changes: 31 additions & 0 deletions src/TgUtils/Auth/DefaultCredentialsProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace TgUtils\Auth;

class DefaultCredentialsProvider implements CredentialsProvider {

private $username;
private $password;

public function __construct($username, $password) {
$this->username = $username;
$this->password = $password;
}

/**
* Returns the username.
* @return string the username
*/
public function getUsername(){
return $this->username;
}

/**
* Returns the password.
* @return string the password
*/
public function getPassword() {
return $this->password;
}

}

0 comments on commit 43f1cd4

Please sign in to comment.