Getting Started with Laravel

Getting Started with Laravel

What is Laravel?

From Wikipedia

Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern. Some of the features of Laravel are a modular packaging system with a dedicated dependency manager, different ways for accessing relational databases, utilities that aid in application deployment and maintenance, and its orientation toward syntactic sugar.

 

TL;DR, instead of building web app with raw PHP code, Laravel is a PHP framework to build app faster, safer, and proper.


Why Laravel?

I started using PHP web framework to develop web app back in year 2009. At that time I used CodeIgniter. It was so easy to use, perfect framework for beginner.

Fast forward to 2015, there are so many new technologies for us to pick, eg. Ruby on Rails, NodeJS, Django, etc… But in the end we still opted for PHP. The main reason being that we are too used to PHP. And also it is easier to find a PHP developer.Whether you like it or not, according to this website, PHP is still used by 81.9% of all web sites.

Next thing is to find a new PHP web framework, because CodeIgniter is basically doomed.

trends.embed.renderExploreWidget(“TIMESERIES”, {“comparisonItem”:[{“keyword”:”/m/0jwy148″,”geo”:””,”time”:”today 5-y”},{“keyword”:”/m/02qgdkj”,”geo”:””,”time”:”today 5-y”},{“keyword”:”/m/09t3sp”,”geo”:””,”time”:”today 5-y”},{“keyword”:”Yii 2″,”geo”:””,”time”:”today 5-y”},{“keyword”:”Symfony”,”geo”:””,”time”:”today 5-y”}],”category”:0,”property”:””}, {“exploreQuery”:”q=%2Fm%2F0jwy148,%2Fm%2F02qgdkj,%2Fm%2F09t3sp,Yii%202,Symfony”});

If you believe in Google Trend, Laravel is undisputedly the best PHP framework at this moment.

https://www.sitepoint.com/best-php-framework-2015-sitepoint-survey-results/

Laravel is an exciting PHP framework to work with. Their documentation is excellent, community keep growing, and being updated frequently and adopt latest trend in web technology. If you can’t find enough info from their official documentation, just head to google and there are tons of tutorial and solution for Laravel.

Few things I like Laravel the most:

  1. Third party packages – There are a lot packages ready for use so you don’t need to reinvent the wheel.
  2. Authentication – Laravel has built-in user auth module, and can be easily customize for 3rd party auth solution.
  3. Migration – By defining database schema in migration file, Laravel make it easy to sync database structure among developers and also make db deployment a lot more faster.
  4. Eloquent ORM – Eloquent is an ActiveRecord implementation to interact with database. In short, it’s better than using raw SQL statement.

How to use Laravel?

For Windows developer

I would recommend Windows developer to use Laragon over WAMP/XAMPP as a local web server. It’s super easy, and fully compatible with Laravel.

I still remember how hard it was to guide my junior to setup Laravel on their computer. Now with Laragon, just a few clicks and you are ready to develop your first Laravel App.

Alternatively, Laravel recommend developers to use Homestead, a vagrant box which provide isolated development environment on your everyday use PC. But I found that it is quite hard to setup for first time user. And it consume more computer resources as it needs to be run on VM.

For Mac/Linux developer

Linux developer – Homestead

Because Homestead runs on virtual machine, it can be run on all OS.

Mac developer – Homestead or Valet

Besides Homestead, Laravel recently released Valet, specifically for Mac OS only. It tout to be easier to setup than Homestead.

I haven’t try Valet myself. If you have tried it out, do share your experience with us.

Text Editor

Web developer can use any text editor to develop their app. But if you want to develop effectively, try SublimeText (or Atom, etc…).

Here are a few must use SublimeText plugin for Laravel developer:

  • Laravel Blade Highlighter – Highlight blade syntax for easy reading
  • Laravel 5 Snippets – Code generator
  • Laravel 5 Artisan – Run Artisan CLI in SublimeText

Look for more packages here: https://packagecontrol.io/


Performance

Many will compare PHP’s performance to technologies such as NodeJS, Ruby, Python, .Net, even JAVA. PHP performance was always lagged behind, but recently we see that there are a lot of progress in PHP.

From PHP-FPM + NGINX, to HHVM from Facebook, to the much anticipated PHP7. PHP has improved a lot in terms of performance. Which then give us more confident to continue using Laravel. We never have issue running Laravel app on even the lowest spec hosting.

For large scale project, our expertise in designing cloud architecture allow us to build a full stack solution from ground up to fully optimize our Laravel app. In the end of the day, it boils down to how we fuse the infrastructure and app together.


What’s next?

Get your hands dirty, go do some Hello World!

So far we have built all sorts of use cases around Laravel. Here are just a few to let you know what Laravel can do:

  • Social authentication
  • Restful API for web or mobile
  • Push notification to web and mobile devices
  • Real time chatting, web and mobile
  • Various payment integration
  • ElasticSearch
  • Transactional email

and really, many more…