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
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';
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();