Welcome to my blog.
You may have noticed that I’ve redesigned this site to give the site a more modern look. It’s been over five years since the sites had a face lift, so I thought it was time to remedy that. The old site was built on the PHP framework CodeIgniter, but I’ve more recently been focusing on Laravel, so decided to recode the site in Laravel while I was at it. I’ve read and heard good things about Laravel for some time, but have never taken the time to dive into it, so I figured now would be a good time.
The learning curve of Laravel is definitely steeper than with codeigniter. But, knowing codeigniter already made it a lot easier to get to know Laravel. Both have routing features, although Laravel’s is much more sophisticated. There’s also a little more work to setting up your routes in Laravel, and it took some time to understand how to set them up. Fortunately, there is very good community support for Laravel, and you can find the answers to most of your questions online. There’s not a huge difference in the way the controllers work between Laravel and Codeigniter. Both allow you to create hierarchy directory structures for your controllers. The one big difference I found is that Laravel makes good use of namespaces. In fact, if you don’t know anything about namespaces, you’ll want to read up on them before starting your first Laravel project. Laravel also takes advantage of other features in PHP5, as well as different design patterns used in the framework.
Laravels models are also different than in CodeIgniter. Laravel offers an active record implementation called Eloquent ORM. Having worked with databases my whole career, I have a distaste for any kind of query utility/helper, and like to use my sql skills to access and save data via PDO. Laravel’s models make it easy to access the underlying PDO object, which is very handy for people like me. I’ve always had some problems using PDO out of the box with CodeIgniter, which may be resolved in the latest version. Even if you don’t use Eloquent, Laravel’s models supply some very handy utilities for working with your data/database. One handy feature is
One of the main advantages of using a PHP framework, is that they supply many levels of security and protection, and Laravel really shines in this respect. One thing I really like is Laravels automatic CSRF protection. If you’re familiar with WordPress’s nonce’s, they work much like those. Laravel also comes with a pretty good authentication system which works out of the box.
Laravel views offers a solution for simplifying your layouts, called Blade. Like with models, I’ve never been one to depend on 3rd party PHP template engines, although I have used Smarty in many of my projects. Blade is a little different though. It seems to be more of a tool for managing layouts than for managing output for your views. It really makes managing your different layouts a breeze, and allows you to manage them in a hierarchial way.
All in all, I do like what Laravel has to offer, and think it will be my preferred framework of choice going forward. I’ll still continue to work CodeIgniter projects, however, as I don’t see CodeIgniter being replaced soon.