diagvn/gluu-php-sdk

Gluu SDK


Keywords
diagvn-patient
License
MIT

Documentation

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Sponsors

About The Project

This library provides some features to connect to Gluu server.

Built With

Laravel

Installation

composer require diagvn/gluu-php-sdk

php artisan vendor:publish Gluu\Providers\GluuServiceProvider --config

Usage

Authenticate:

    public function authenticate(
        ?string $username,
        //Password can be null, if password = null, default password = config('gluu.default_password')
        ?string $password, 
        string $grantType,
        ?string $scope = null
    ) : ?array

Register user

    public function register(
        string $username, 
        //Email can be null, if email = null, default email phoneNumber@gluu.diag.vn
        ?string $email,
        string $phoneNumber, 
        //Password can be null, if password = null, default password = config('gluu.default_password')
        ?string $password): mixed

Example:

use Gluu\App\AuthenticationInterface;

class AuthController extends Controller
{
    public function __construct(
        private AuthenticationInterface $authenticationService,
    ) {
    }
    
    public function index(Request $request)
    {
        $this->authenticationService->register(
                username:$request->username,
                email: $request->email,
                phoneNumber: $request->phone_number,
                password: $request->password
            );
        $result = $this->authenticationService->authenticate(
                username: $request->username,
                password: $request->password,
                grantType: "password",
                scope: "openid"
            );
     return 
    }
}

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Bradley Nguyen - giang.nguyen@diag.vn

Travis Au - toan.au@diag.vn

Duc Bui - duc.bui@diag.vn

ricky-morty

Sponsors

diag