atm/fingerprintbundle

Fingerprint management bundle

Maintainers

👁 ALTUMA

Package info

bitbucket.org/ALTUMA/atm_fingerprint

Type:symfony-bundle

pkg:composer/atm/fingerprintbundle

Statistics

Installs: 598

Dependents: 0

Suggesters: 0

1.28 2020-02-14 09:32 UTC

Requires

  • php: >=5.3.9

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 7adf8ac4cf0934c2e373d9410667d15511d79cba

  • Alberto Tuzon <atuzon1986.woop@gmail.com>

atm fingerprint bundle

This package is auto-updated.

Last update: 2026-06-15 00:12:21 UTC


README

A Fingerprint bundle to send data to the fingerprint api

Installation

Install through composer:

php -d memory_limit=-1 composer.phar require atm/fingerprintbundle

In your AppKernel

public function registerbundles()
{
 return [
 	...
 	...
 	new ATM\FingerprintBundle\ATMFingerprintBundle(),
 ];
}

Configuration sample

Default values are shown below:

# app/config/config.yml
 
atm_fingerprint:
 fingerprint_error_redirect_route_name: 'route to redirect the user when the fingerprint is not found'
 site_name: 'sitename'
 error_message: 'a message to show to the user when the fingerprint is not found'
 use_assetic: false

If you application uses assetic remember to include de ATMFingerprintBundle in the assetic array bundles in your config.yml file:

 assetic:
 bundles: ['ATMFingerprintBundle']

Include to the main page

{% include 'ATMFingerprintBundle:Fingerprint:store_fingerprint.html.twig' %}

Events

There are 2 events that you can use when the response from the API:

  • error:

    class StatusError extends Event{
    
     const NAME = 'atm_fingerprint_error.event';
    
     protected $user;
     protected $response;
    
     public function __construct($user,$response)
     {
     $this->user = $user;
     $this->response = $response;
     }
    
     public function getUser()
     {
     return $this->user;
     }
    
     public function getResponse(){
     return $this->response;
     }
    }
    
  • success:

    class StatusSuccess extends Event{
    
     const NAME = 'atm_fingerprint_success.event';
    
     protected $user;
     protected $response;
    
     public function __construct($user,$response)
     {
     $this->user = $user;
     $this->response = $response;
     }
    
     public function getUser()
     {
     return $this->user;
     }
    
     public function getResponse(){
     return $this->response;
     }
    }
    

Event Listener

There is an Event Listener that listens for kernel requests with a priority of 3 and sets a session variable called 'atm_fingerprint_custom_redirect'.

ATM\FingerprintBundle\EventListener\FingerprintRedirect:
 autowire: true
 public: true
 tags:
 - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 3 }
 arguments:
 $atm_fingerprint_config: '%atm_fingerprint_config%'

You can set a custom request listener with a low priority to redirect to another place or to put some custom code. Remember to remove the session variable 'atm_fingerprint_custom_redirect'

AppBundle\EventListener\CustomRequestListener:
 autowire: true
 public: true
 tags:
 - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 2 }
namespace AppBundle\EventListener;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

class CustomRequestListener{

 private $session;

 public function __construct(SessionInterface $session){
 $this->session = $session;
 }
 
 public function onKernelRequest(GetResponseEvent $event){

 if($this->session->has('atm_fingerprint_custom_redirect')){
 $this->session->remove('atm_fingerprint_custom_redirect');
 
 // YOUR CODE GOES HERE
 
 $event->setResponse(new Response());
 }
 }
}