hyvor/laravel-hyvor-connecter

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.1.7) of this package.

Connecting Hyvor applications to Hyvor auth

1.1.7 2023-01-12 01:35 UTC

This package is not auto-updated.

Last update: 2024-01-28 15:23:41 UTC


README

Installation

composer require hyvor/laravel-hyvor-connecter

Config

Add these to the .env

  • HYVOR_URL - URL of Hyvor. This is internal IP in production. In testing, you may use the local URL.
  • HYVOR_API_KEY - API Key.
  • HYVOR_DUMMY - Set this to true in development so that dummy data will be return. Therefore, you don't need to have the auth set up and running to test the other application. Login check will always be true when using this.

Hyvor User Object

The properties of the HyvorUser object, which is returned in endpoints.

public int $id;
public string $username;
public string $name;
public string $email;
public ?string $picture_url;
public ?string $location;
public ?string $bio;
public ?string $website_url;

Checking Login

use Hyvor\HyvorConnecter\Login;

$user = Login::check(); // null | HyvorUser

Getting User Data

use Hyvor\HyvorConnecter\Userbase;

// get one from ID (email is not set in the HyvorUser object)
Userbase::fromId($id);

// get one from ID with email
Userbase::fromId($id, true);

// get multiple from ID
Userbase::fromIds([$id1, $id2, ...], bool $email);

Userbase::fromUsername();
Userbase::fromUsernames();
Userbase::fromEmail();
Userbase::fromEmails();

Redirecting to Auth

Return URL will be added automatically so that the user will come back to the page specified after logging in or signing up.

use Hyvor\HyvorConnecter\Redirect;

Redirect::to('account');
Redirect::toLogin();
Redirect::toSignup();