Clean PHP Programming With PHP Framework Laravel

PHP Framework Laravel

What is Laravel?

Laravel is a relatively new PHP framework which uses the MVC architecture.

Why use Laravel?

Good question. Lately I’ve been looking into PHP frameworks to start a personal project of mine. In my last work project I used CodeIgniter, which was great, but I think it has room for improvement. CodeIgniter worked great for what I needed it to do for me, it was really easy to learn and easy to move into production. After trying Laravel though I feel like Laravel is a few steps ahead of the framework game.

Laravel is very well documented and easy to learn also. It is open source and released under the MIT license. There are many tutorials and screencasts on Laravel so the average web developer should have no troubles getting started on a project.

Tell me more!

You got it! Laravel uses a template system called Blade. Blade provides an easy and clean way to display php variables to your application/page. Blade also comes with some very handy functions such as forelse and unless. Example, in php if you wanted to loop through an array and display its contents you do the regular foreach. But if you wanted to display something else if the array was empty you would need to nest the foreach in an if statement and using proper formatting it gets messy quickly, that’s where forelse comes in. Forelse is a Blade function that will act like php foreach statement unless the array is empty then it gets directed to the @empty statement. This is structured the same way as an if else statement so it looks much cleaner. Check out the Blade documentation for other great control structures.

Another great feature is the Eloquent ORM. This enables you to create simple CRUD statements of a database table with a single line. You’ll have to watch a video on it to see it’s real power but it’s worth using Laravel for that feature alone considering how much time it will save.

Then there is Fluent’s database access. This is much like CodeIgniter’s Active Record implementation but all the same it is a great way of writing database queries.

If you’re starting a PHP project, check out Laravel, you’ll be glad you did.

I’m your typical 24 year old guy who loves technology. I have a Computer Programmer Analyst diploma and am in my 3rd year of a Bachelor of Computer Science degree while working full-time as a programmer. I have experience in multiple programming languages, content management systems, frameworks, and markup languages including but not limited to; Javascript, CSS, HTML, Coldfusion, PHP, C, C++, C#, Java, Pythin, Codeigniter, Laravel, Sharepoint 2010, WordPress, Drupal, and I’m sure there’s a few more I’m forgetting to mention.

Tagged with: , , , , ,
Posted in PHP, Tips, Web Development
0 comments on “Clean PHP Programming With PHP Framework Laravel
1 Pings/Trackbacks for "Clean PHP Programming With PHP Framework Laravel"
  1. [...] Clean PHP Programming With PHP Framework Laravel – Jimsider …Laravel is a relatively new PHP framework which uses the MVC architecture. Laravel is very well documented and easy to learn also.www.jimsider.com/clean-php-programming-laravel/ [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

%d bloggers like this: