vircom/epuap2

ePUAP2 library

0.0.1 2016-03-14 16:10 UTC

This package is auto-updated.

Last update: 2024-10-27 23:52:34 UTC


README

Build Status

VirCom ePUAP2 is a PHP library that makes it easy to communicate with ePUAP2 platform.

  • Generating URL's for login and logout actions with ePUAP2 platform

Installation

The recommended way to install VirCom ePUAP2 library is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, you should run command below, to install the latest stable version of package:

composer.phar require VirCom/ePUAP2

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Authentication URL generators

This section delivers examples of usage URL generator methods.

Login code example:

require_once('..\vendor\autoload.php');

use VirCom\ePUAP2\AuthenticationFactory;
use VirCom\ePUAP2\Requests\Login;

$factory = new AuthenticationFactory();
$service = $factory->createService();

$url = $service->getLoginUrl(
    new Login(
        'https://hetmantest.epuap.gov.pl/DracoEngine2/draco.jsf',
        'http://your.application.url',
        '/your.application.id'
    )
);

header('Location: ' . $url);
exit();

Logout code example:

require_once('..\vendor\autoload.php');

use VirCom\ePUAP2\AuthenticationFactory;
use VirCom\ePUAP2\Requests\Login;

$factory = new AuthenticationFactory();
$service = $factory->createService();

$url = $service->getLogoutUrl(
    new Logout(
        'https://hetmantest.epuap.gov.pl/DracoEngine2/draco.jsf',
        'your.username',
        '/your.application.id'
    )
);

header('Location: ' . $url);
exit();