Download the PHP package almefy/client without Composer

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

Almefy PHP Client

A simple dependency-free PHP wrapper for the Almefy API.

Quick Guide

Below is a quick guide how to integrate Almefy in your PHP project to test it easily. We are already preparing a comprehensive documentation covering all possible use cases and parameters. So stay tuned.

Please notice: this document is work in progress.

Prerequisites

To successfully initialize the PHP client, you'll need an API key and API secret from Almefy.

Installation

Almefy PHP Client is available on Packagist as the almefy/client package. Run composer require almefy/client from the root of your project in terminal, and you are done. If you cannot use composer for any reasons you can download the latest version from GitHub. The minimum PHP version currently supported is 8.0.

Client Initialization

Once you have the package installed, you will need to instantiate a Client object. This example assumes that you store the secrets in some environment variables:

Identity Enrollment

Before a user account can be used with the Almefy app, it needs to be enrolled and the device provisioned. The easiest way to enroll an account with Almefy is to send the user an email with an enrollment QR Code inside. A good starting point could be a "Connect with Almefy" button somewhere inside the protected area, which triggers the following process in the backend:

The returned $enrollmentToken object provides a public base64ImageData property with the base64 encoded image data that can be used in any HTML email.

If enabled, you can also use the Almefy API to send a generic enrollment email without the effort to build a custom email-client compatible template:

Notice: Check out the API Enrollment Reference for all available options.

This process creates or uses an existing identity and sends out an enrollment email with a QR Code inside, that needs to be scanned with the Almefy app to provision it. Once done, the enrollment is completed, and the user is ready to authenticate using the Almefy app.

Frontend

Add the following few lines to your HTML frontend to show the Almefy image used for authentication.

Authentication

The authentication controller configured in the data-alemfy-auth-url will receive the X-Almefy-Authorization header from the Almefy API. The first thing needs to be done inside the controller is extracting the token from the header and decode it (it is also verified).

Notice: The JWT is provided using the X-Almefy-Authorization header for compatibility reasons (e.g. Apache webserver not forwarding it to the PHP process), but also using the standard Authorization: Bearer ... header.

Next you should check if the user trying to authenticate is in your own identity management system and allowed to authenticate. This is your own business logic, thus just as an example:

The last and important step is to verify and confirm the authentication attempt on the Almefy system:

Notice: For security reasons any network or server error will always return false.

At this stage you can authenticate the user by setting up session etc. and redirect him to the protected area.

License

The Almefy PHP SDK is licensed under the Apache License, version 2.0.


All versions of client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-json Version *
ext-curl Version *
ext-mbstring Version *
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 almefy/client contains the following files

Loading the files please wait ....