Welcome, everyone! In the first article of this series, I’m going to walk you through what we’re going to cover in this Laravel for beginners series. If at any point you have a doubt, let me know in the comment section below. I’ll answer all the comments made any part of this series. So let’s start!
What is Laravel and what are we going to cover in this series?
Laravel is one of the most popular PHP frameworks for developing web applications a lot faster and easier. I hope you’ve already worked with PHP and know how the stuff works. You need to take care of everything yourself including database connections, securing database queries before hitting the server database or develop your own functions to handle certain tasks in your application. Laravel does all that (even more) for you out of the box. The MVC system makes it really easy to handle any user request, process it nicely and easily and surf the required output back to the user.
What will you learn in this series?
This series is going to cover the basics of Laravel. We’ll start from basics of Laravel along with building a nice Content management system. For this series, you should already some knowledge of PHP.
Why is Laravel or any other framework useful?
As I said above when creating applications in core/vanilla PHP, you need to write all the code yourself for handling some complicated tasks such as getting user requests for database, clearing them against any potential SQL injection, logging the user in, creating user sessions (logging user in) and so on. These were just some examples, there are a lot more such functions are created while working with vanilla PHP. But a framework (here Laravel) does that all for you easily, saving you lots of time and of course money.
Let me explain it even more. Let’s say a user types his username and password. Now you as a developer needs to encrypt the password, compare it with the database and return if the user is found or not. Here the encryption part is very important. The user will require to use vanilla PHP functions to encrypt the password and take care of what encryption method is more secure or which one is not.
If you’re working in Laravel, it provides a Hash class. You can call functions of the class to any string or number to encrypt it. In this case, we’ll just use make() to encrypt the user password.
$password = "simplePassword";
$encryptedPassword = Hash::make($password);
And that’s it. The developers have already worked on making things more secure. It’s more trustworthy as you don’t have to google to know which encryption method is more secure.
Similarly, you can create user sessions, destroy user sessions, send emails in an easy way, automate tasks using Laravel schedule class method or run cron jobs. Now just this, the biggest advantage of using any popular framework is that it has lots of useful plugins and if you have any doubt, there are thousands of developers to help you resolve your doubts.
If you think Laravel misses a certain feature, then you can for a plugin for it. There is a great website for getting Laravel packages called Packalyst. Currently, on Packalyst, there are 15,915 laravel plugins. It means the function you want to create has more likely been created by somebody else. All you need is get it to your app.