Download the PHP package nodes/nemid without Composer

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

Nem-id integration

A PHP Laravel library for using the Danish NemID for authenticating a user.

I'm sure it can be used easily without laravel also. Feel free to contribute to improvements

image

The library supports:

This is a rewrite of an original library for an older version of the applet in java

Original library can be found: https://code.google.com/p/nemid-php/

To become a nemid partner please follow this Link

You must then modify your composer.json file and run composer update to include the latest version of the package in your project.

Or you can run the composer require command from your terminal.

🔧 Laravel Setup

Setup service provider in config/app.php

Publish config files

If you want to overwrite any existing config files use the --force parameter

Certificates

Make sure you have bcmath installed

If your p12 file is password protected and the password holds special characters, see this stack overflow post

You got your p12 certificate now generate pem files, use following commands:

publicCertificate:

openssl pkcs12 -in path.p12 -out certificate.pem -clcerts -nokeys

NB: Remove the initial lines with Bag Attributes if present.

Only the -----BEGIN CERTIFICATE-----, the base64 encoded certificate and -----END CERTIFICATE----- are relevant.

privateKey & privateKeyPassword

openssl pkcs12 -in path.p12 -clcerts -out privateKey.pem

Openssl will prompt you for a PEM pass phrase that will have to be set in your nemid.php configuration.

certifateAndPrivateKey & password (For PID/CPR match)

openssl pkcs12 -in path.p12 -out certificateAndPrivateKey.pem -chain

The -nodes flag disables encryption and password protection of your certificates (it has nothing to do with Nodes).

If left out Openssl will prompt you for a PEM pass phrase that will have to be set in your nemid.php configuration.

Now you have all the certificates needed -

Copy the config file to htdocs and fill settings

Look in the config file for more help

Login integration

In the inspiration folder an example of how you can setup the login flow can be found.

First prepare parameters to inject into the iframe. By creating a Login object.

$login = new Login(config('nodes.nemid'));

Setup a html document with the iframe url, js with param data and a form for callbacks

$login->getIFrameUrl();

$login->getParams();

The iframe will now submit the response to the form

The submitted data is base64 encoded, besides that all errors comes as string while successfully logins are xml documents

$response = base64_decode(\Input::get('response'));

CertificationCheck::isXml($response)

Now validate the certificates and extract name and PID from it by initialize a CertificationCheck object

$userCertificate = new CertificationCheck(config('nodes.nemid'));

$certificate = $userCertificate->checkAndReturnCertificate($response);

$certificate->getSubject()->getName();

$certificate->getSubject()->getPid();

PID/CPR match integration

Initialize a PidCprMatch object and call the function with pid and cpr params.

$pidCprMatch = new PidCprMatch(config('nodes.nemid'));

$response = $pidCprMatch->pidCprRequest($pid, $cpr);

A response object will be returned. The object has functions to to check match and possible errors

$response->didMatch();

Misc

Enjoy


All versions of nemid with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ~6.0
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 nodes/nemid contains the following files

Loading the files please wait ....