Laravel 4 Swift Mailer with dynamic config instead of mail.php to send mail through Gmail

Laravel 4 comes with the Swift Mailer library which works great in sending emails from your application. Just set the mail.php configuration file with the required variables and you are good to send emails. Inline images, attachment are like one line code. But the problem with a config file is that the parameters are fixed. I had a requirement where user would send email using their Gmail username and password. So, in this tutorial I will show you how to create a Swift Mailer instance and send a mail with a dynamic username, password and other parameters. Continue reading “Laravel 4 Swift Mailer with dynamic config instead of mail.php to send mail through Gmail”

Laravel 4 forms, retain data, default and custom validations

Working with forms in Laravel 4 is real fun and there is hardly any PHP application which doesn’t have a form. So, in this tutorial I will demonstrate how to create a simple registration form using the Laravel’s form library. Then we will validate the data when the form is submitted. We will use the validation library which comes with Laravel 4 out of the box and also our custom validation rule. Continue reading “Laravel 4 forms, retain data, default and custom validations”