Skip to content

RonaldKlaus/authentication_bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Steps to create a login-form with symfony2

  1. Setup Symfony

  • install apache (via XAMMP)

  • download framework

  • create folder in XAMMP/htdocs

  • copy framework in this folder

  • create bundle with

    $ php app/console generate:bundle bundleName

  1. Create Database

  • create database for users-table
  • create users-table (email, password, lastname, firstname etc.)
  • create role for database with password
  1. Setup parameters.yml

  • add database_name
  • add user_name
  • add user_password
  1. Generate mapping and entities

  • mow the application needs some mapping between the bundle and the database
  • we are using doctrine (maybe install with composer? Shouldn't be necessary)
  1. create mapping:

    $ php app/console doctrine:mapping:import bundleName

  2. create entities (create the models of the tables in the database)

    $ php app/console doctrine:generate:entities bundleName

  1. Add login-form in special login.html.twig

  • add form-tag with method='POST' and action={{ path('route_name_to_login_action') }}
  • add input for email (add name-parameter)
  • add input for password (add name-parameter)
  • add button for submit (add submit-parameter)
  1. Add login-action to controller

  • add Request-Class with use-command
  • initialize EntityManager
  • initialize Repository (to search in the DB)
  • get parameters from Request-Object (email and password)
  • add user-validation via DB check

About

Symfony-bundle to for a working authentication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published