divi/ajax-login-bundle

Ajax Form Login for Symfony 2 PHP Framework

Installs: 41 692

Dependents: 0

Suggesters: 1

Security: 0

Stars: 25

Watchers: 4

Forks: 5

Open Issues: 2

Type:symfony-bundle

dev-master 2014-07-25 11:52 UTC

This package is not auto-updated.

Last update: 2024-04-13 11:35:55 UTC


README

A simple AJAX form login for Symfony 2.

Prerequisites

This version of the bundle requires Symfony > 2.1. If you have the version 2.0 or 2.1, please switch to the branch 2.0-2.1.

Installation

Step 1: Download AjaxLoginBundle using composer

In your composer.json, add AjaxLoginBundle :

{
    "require": {
        "divi/ajax-login-bundle": "dev-master"
    }
}

Now, you must update your vendors using this command :

$ php composer.phar update divi/ajax-login-bundle

Step 2: Enable the bundle

Enable the bundle using the AppKernel :

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Divi\AjaxLoginBundle\DiviAjaxLoginBundle(),
    );
}

Step 3: Configure your project

Configure your form login using security.yml, replace "form_login" authentication by "ajax_form_login"

# app/config/security.yml
security:
    firewalls:
        main:
            pattern: ^/
            ajax_form_login:
                # ...

How to use

Examples

Two examples are available in the Resources/views/Login folder. Note: jQuery is required for these two examples. If not exists, it will be loaded dynamically (with Google API). The first example works with the AcmeBundle (Symfony standard) form login, the second with the FOSUserBundle form login.

If you want to use the javascript part on your login twig form, just include the init file :

{% include 'DiviAjaxLoginBundle:Javascript:init.html.twig' with {'form_selector': '#your_form_id'} %}

Issue or new feature ?

Feel free to post your issue or feature request in the issue tracker !