Download the PHP package leonmelis/uq_free without Composer

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

Unofficial Ubiqu Free API implementation for PHP

This is an unofficial PHP implementation for the Ubiqu Free API. The maintainer of this project is not affiliated with Ubiqu.

License: MIT

Installation

This library can easily be installed through Composer.

Then use it in your PHP code using:

Requirements

NOTE: this library uses phpseclib internally. It is recommended (but not required) by phpseclib to have the PHP ext-openssl module installed for better performance.

Getting started

Before getting started, you should have the Ubiqu Authenticate app installed on a mobile device:

Then, create a new ServiceProvider:

The ServiceProvider object is now created on the Ubiqu server, but not yet active. To activate the provider (and also become owner of it) use the Authenticate app on your mobile device, choose 'auto-activate' from the settings menu and enter the 9 digit nonce from the ServiceProvider object when prompted.

Store the API key and UUID for this provider.

A previously created ServiceProvider can be constructed by passing the UUID and API-key to the constructor:

Creating assets

An Asset is created through an Identification object. This may be confusing at first, but you have to remember that we don't know the device that will control the asset at this point in time.

The Identification object contains a nonce which can be entered in the Authenticate app. Once completed a callback is made from the Ubiqu Free API, notifying us that the identification has been consumed and the asset is ready to use.

Performing an AssetRequest

The AssetRequest allows to perform a cryptographic method on the private key owned by the end user. This is the heart of the Ubiqu system. The user gets a push-message on their mobile device, asking to approve or reject the request, unlocking their private key using their PIN. Since we have the public key we can validate the signature we receive.

Creating a CSR

It is possible to create a CSR without possession of the private key. However, this is uncommon and requires knowledge of the CSR internal structure (ASN.1). So, a CSR class is added to help you with performing this procedure.

Callbacks

Due to the asynchronous nature of the Ubiqu Free protocol (waiting for the user to approve/reject the AssetRequest through the app) the Ubiqu Free API makes callbacks to the callback_url passed to the API during creation of the ServiceProvider. Ubiqu makes a callback every time an object owned by the ServiceProvider changes state.

To handle the callbacks, use the CallbackHandler class.

The CallbackHandler constructor accepts a CacheInterface instance for persisting the received updates, of pushing the changes to some data bus.

Caching / persisting

By default, the Connector class uses a MemoryCache instance for caching. This prevents having to fetch the same object more than once from the API.

However, the MemoryCache is of limited use, due to the very nature of PHP being restarted on each call. Also, this Ubiqu Free library is fairly useless if objects cannot be persisted to something like a database.

To create your own caching/persistence class, all you need to do is implement the CacheInterface interface, consisting of 2 simple methods. Pass an instance of that class to the Connector constructor.

The data is passed to the writer as a raw stdClass as received from the API. The reader is expected to return a stdClass instance or an associative array.

You don't necessarily need to store all fields of the UQObject instances, or even store every object type.

For all UQObject instances you should at least store the UUID and state (status_code). For an Asset you must also store the value of public_key. All other fields are currently not required for the functioning of this library.

More information

https://ubiqu.com/developers/ubiqu-free-tutorial/

https://ubiqu.com/developers/freetutorial-creating-service-providers/


All versions of uq_free with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6 || ^7.0
phpseclib/phpseclib Version ~2.0
ext-curl 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 leonmelis/uq_free contains the following files

Loading the files please wait ....