Im writing this book (and the tutorials) in the hope that people can learn the things I have about Laravel 4. Its not meant as a replacement for any of the great Laravel books, but instead as a complement to the resources, documentation and framework.
This book teaches various aspects of Laravel 4 implementation, configuration and usage; as part of separate projects. The idea is not to demonstrate the only or best way to create any of these projects. Its not to show the only or best way to use Laravel 4. Its simply a different (and subjective) kind of documentation to the modularised version found at: http://laravel.com/docs
While this book touches on in the installation and hosting of Laravel applications; its not an exhaustive reference for how to do these things. There are some instructions; which should be enough to get you up and running, but it assumes you are familiar with how things like LAMP (Linux, Apache, MySQL and PHP) work and are capable of installing and maintaining them.
Why Write This Book
I was learning how to use Laravel 4 more effectively, and found some subjects which I felt were worth sharing. I picked Medium (which later turned out to be a huge pain) and started putting a tutorial together. A few hours later I hit publish
Then @laravelphp retweeted a link to the article. I think I spent the rest of the day just watching stats. The tutorial hit Mediums home page. It turns out there are a lot of people who wanted to know about Authentication (in Laravel), and just needed to be exposed to the article through @laravelphps promotion of it.
Since then; I have been releasing a tutorial every two weeks.
The book grew out of the realisation that; while loads of people were reading the tutorials on Medium, some people werent happy with the platform.
There are many compelling reasons for me to keep on using Medium to host the tutorials. I dont want to host my own thing because uptime is important, and outages in the night add years onto my life. The simple statistics and text formatting are also great.
I want to stay on Medium, but I also want people to want to read the tutorials and learn from them on other platforms. The book allows both of these things, as well as an important third thing
The book is also intended as a means to give back to Laravel; in particular the invaluable work of Taylor Otwell. To this end, I have committed to give half of all sales to Taylor. The tutorials will always be free on Medium, and their content will mirror the chapters of this book (with obvious repetition omitted), but by purchasing this book you are helping to fund future Laravel development from him and tutorials from me.
Installing Laravel 4
Laravel 4 uses Composer to manage its dependencies. You can install Composer by following the instructions at http://getcomposer.org/doc/00-intro.md#installation-nix.
Once you have Composer working, make a new directory or navigation to an existing directory and install Laravel 4 with the following command:
1
composer create-project laravel/laravel ./ --prefer-dist
If you chose not to install Composer globally (though you really should), then the command you use should resemble the following:
1
php composer.phar create-project laravel/laravel ./ --prefer-dist
Both of these commands will start the process of installing Laravel 4. There are many dependencies to be sourced and downloaded; so this process may take some time to finish.
Authentication
If youre anything like me; youve spent a great deal of time building password-protected systems. I used to dread the point at which I had to bolt on the authentication system to a CMS or shopping cart. That was until I learned how easy it was with Laravel 4.
The code for this chapter can be found at https://github.com/formativ/tutorial-laravel-4-authentication.
This tutorial requires PHP 5.4 or greater and the PDO/SQLite extension. You also need to have all of the requirements of Laravel 4 met. You can find a list of these at http://laravel.com/docs/installation#server-requirements.
Installing Laravel
Laravel 4 uses Composer to manage its dependencies. You can install Composer by following the instructions at http://getcomposer.org/doc/00-intro.md#installation-nix.
Once you have Composer working, make a new directory or navigation to an existing directory and install Laravel with the following command:
1
composer create-project laravel/laravel .2
3
Installing laravel/laravel (
v4.1.27)
4
...
If you chose not to install Composer globally (though you really should), then the command you use should resemble the following:
1
php composer.phar create-project laravel/laravel .2
3
Installing laravel/laravel (
v4.1.27