Download the PHP package networkrailbusinesssystems/entra without Composer

On this page you can find all versions of the php package networkrailbusinesssystems/entra. 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 entra

Entra

Authenticate users with Entra Single Sign On

Limitations

Due to Network Rail policies, Entra applications cannot be given application level access.

As such, we cannot poll Entra directly with guest users.

Since our systems require guests to be able to poll the directory, Entra can only be used for authentication.

Installation

  1. Install using Composer:

  2. Publish the entra.php config file:

    • You may skip this step if your User model's FQN is App\Models\User
    • Set the entra.models.user setting to your User model:
  3. Adjust your .env to include the required settings
  4. Implement the AuthenticatesWithEntra interface on your User
  5. Add the Entra routes to your routes/web.php using the macro:

  6. Secure your other routes using the EntraAuthenticated middleware:

  7. Use the EntraTokenExists middleware on routes which require an access token:

Configuration

The following settings can be changed in your .env:

.env key Config key Required Notes
ENTRA_CLIENT entra.client Yes The Entra application / client ID
ENTRA_PROXY entra.proxy No The proxy URL to use for connecting to Entra
ENTRA_SCOPES entra.scopes No The scopes to use when polling Entra
ENTRA_SECRET entra.secret Yes The Entra application secret
ENTRA_TENANT entra.tenant Yes The Entra directory / tenant ID

The following additional settings are available in the entra.php configuration file:

Config key Required Default Notes
entra.models.user Yes App\Models\User The FQN to your User model

Usage

There are two main ways to use this library:

  1. Automatic login
  2. User initiated login

Automatic login

To automatically login Users across the entire system, simply wrap all your web routes in EntraAuthenticated.

User initiated login

If some pages should be available without a login, only wrap the needed web routes in EntraAuthenticated.

When users attempt to access those pages they will be logged in automatically.

You could also provide a Sign in or Login button someone on your interface which points to the entra.login route.

Signing out

Users can visit the entra.logout route to sign out.

This will only sign them out of the local system, not their Entra browser session.

Preventing Users being created

Some systems do not allow User models to be created automatically.

To prevent this, call abort() or throw an exception in your AuthenticatesWithEntra implementation.

Access Token

You can find the current EntraAccessToken for the logged in User in their session:

Entra may be expanded in the future with endpoints for use.

Testing

Add the AssertsEntra trait to your testing class to use the following methods:

Method Parameters Returns Notes
useEntraEmulator void Adds HTTP mocks to all Entra endpoints with successful responses
entraShouldFail string $error void Causes all Entra endpoints to fail with an error message
entraShouldReturnEmpty void Causes all Entra endpoints to return an empty result set
entraFakeUser bool $model EntraUser, array Create a mock EntraUser model or dataset
entraUsersResponse int $count, bool $nextLink array Create a mock EntraList filled with EntraUsers

All versions of entra with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^13|^12
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 networkrailbusinesssystems/entra contains the following files

Loading the files please wait ...