Download the PHP package hyvor/internal without Composer

On this page you can find all versions of the php package hyvor/internal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package internal

internal

This package provides the following features for HYVOR applications in Laravel:

Installation

Auth

This library provides a unified authentication system for the following providers:

Configuration

The following environment variables are supported. See config.php for configuration options. Environment variables should be set in the .env file.

ENV Description Default
AUTH_PROVIDER The authentication provider. One of hyvor, oidc, or fake. fake
hyvor provider
AUTH_HYVOR_URL Public URL of the HYVOR instance. Users are redirected here for login and signup https://hyvor.com
AUTH_HYVOR_PRIVATE_URL If the HYVOR instance is on a private network, set this to the private URL. Otherwise, the public URL will be used. AUTH_HYVOR_URL
AUTH_HYVOR_API_KEY REQUIRED. The API key of the HYVOR instance. This is used to fetch user data. test-key

User Data

The AuthUser class is used to represent the user. It has the following properties:

Fetching Data

Fetching user data should always be done using API calls rather than using SQL joins in application-level queries, even if OpenID Connect is used. This is because HYVOR user data is always stored in an external database.

Use the following methods to fetch data by user ID, email, or username:

Auth check

To check if the user is logged in:

Redirects

Programmatic Redirects

Use the following methods to get redirects to login, signup, and logout pages:

By default, the user will be redirected to the current page after login or logout. You may also set the redirect parameter to redirect the user to a specific page after login or logout:

HTTP Redirects

The following routes are added to the application for HTTP redirects:

All endpoints support a redirect parameter to redirect the user to a specific page/URL after login or logout.

Testing

In testing, the provider is always set to fake. The FakeProvider always generate dummy data for all requested ids, emails, and usernames. This is useful for testing. You may also set a database of users for the FakeProvider to return specific data for specific users as follows:

When a database is set, the FakeProvider will return the user data from that database only. This is useful for testing the following scenarios:

In most other cases, you should be able to use the Fake provider without setting a database. Because it automatically generates dummy data for all users, you do not need to seed a database before each test case. However, note that user's data will be different for each test case.

HTTP

This library provides a few helpers for handling HTTP requests.

Exceptions

HttpException

Use Hyvor\Internal\Http\Exceptions\HttpException to throw an HTTP exception. This is, in most cases, this error will be sent to the client in the JSON response. Therefore, only use this in middleware and controllers (never in domains). Never share sensitive information in the message.

Middleware

Auth Middleware

Use Hyvor\Internal\Http\Middleware\AuthMiddleware to require authentication for a route.

If the user is not logged in, an HttpException is thrown with status code 401. If the user is logged in, an AccessAuthUser object (extends AuthUser) is added to the service container, which can be used as follows:

Routes

Here's a list of routes added by this library:

Models

HasUser Trait

You may add the Hyvor\Internal\Auth\HasUser trait to any model to add a user() method to it. This method returns the AuthUser object, using the user_id column of the model.

Internationalization

This library provides some helpers to handle internationalization. Most of the time, strings are used in the front-end in HYVOR apps, but for some cases like emails, you may need to translate strings in the back-end. Similar to our Design System, we use the ICU message format. Therefore, you can share the same translations between the front-end and back-end.

All JSON translation files should be places in a directory, which is set in the config file. The default directory is resources/lang. The file name should be the language code (e.g. en-US.json). The file should be a JSON object with keys as the message IDs and values as the translations. Nested keys are also supported. The locales are loaded from the files in the directory.

Usage

The locale is matched to the closest available locale. For example, if you have the following locales:

You can also use the ClosestLocale class to get the closest locale to a given locale.

The I18n singleton class is the base class that manages the locales in the app.

Media

This library adds the /api/media/{path} route to your app. This route will serve/stream files from the default storage disk. This makes it easy to serve the files from the same domain.


All versions of internal with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
ext-intl Version *
guzzlehttp/guzzle Version ^7.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyvor/internal contains the following files

Loading the files please wait ....