Opportunity to be better at PHP – Nov 24, 2011 – Features of Laravel



Opportunity to be better at PHP – Nov 24, 2011 – Features of Laravel

0 2


laravel-an-opportunity-to-be-awesome

My Presentation for Devcon Laravel CodeCamp (March 14, 2015) using revealJS

On Github jpalala / laravel-an-opportunity-to-be-awesome

Opportunity to be better at PHP

by Joe palala RevealJS Created by Hakim El Hattab / @hakimel

A brief history

June 9, 2011

Laravel 1.0 Note: PHP5.3 - August 2009

Taylor Otwell, the creator of Laravel, wanted to create a framework with out of the box functionality:

  • such as authentication
  • closure routing

Codeigniter 1.x, a popular framework lacked these out-of-the-box functionality

PHP 5.3.0 offers a wide range of new features: Support for namespaces has been added. Support for Late Static Bindings has been added. Support for jump labels (limited goto) has been added. Support for native Closures (Lambda/Anonymous functions) has been added. There are two new magic methods, __callStatic() and __invoke(). Nowdoc syntax is now supported, similar to Heredoc syntax, but with single quotes.

Nov 24, 2011

Laravel 2

Controller support "Blade" templating engine Inversion of Control container. "With controllers, it became a fully qualified MVC framework. "

Feb 22, 2012 -

Laravel 3

Unit Test Integration Artisan command line Database migrations Events More session drivers and database drivers Integration for Bundles Eloquent originally released as a bundle

May 28, 2013

Laravel 4

  • A rewrite which made laravel a collection of integrated packages to make a framework
  • Composer management
  • database seeding
  • message queues built in mailer
  • Eloquent ORM new features: scopes, soft deletes and more

Laravel 5

That was released this year - Feb 4, 2015

We have a new Directory Structure, composer loading uses PSR-4

Method injection, just declare the class under composer, and you can directly reference it.. and many more

Why Laravel instead

  • CodeIgnite - not being updated anymore
  • Yii - just as good, high learning curve. Laravel vs Yii
  • Symfony2, Zend2 etc.. - really good, steep learning curve, documentation is intense, but nice to have on resume
  • Laravel vs Symfony
  • Laravel vs Zend

Features of Laravel

Migrations, Seeding, Deployment - built-in

Easy to get started see Zero to Deploy
composer create-project laravel/laravel demo-project
signup for free dev plan at fortrabbit in fortrabbit, you can just git clone your site and update your git repo, and it will update your site Zero-to-deploy

Laravel Features - Routes

In laravel, routes help you define the path to the "resources" of your app.This makes sense for your developers to know immediately what routes or URL's your application has.

Laravel Features - Eloquent ORM

Object relational model based on ActiveRecord called Eloquent.

Eloquent allows you to easily define models and their relationships and makes you do less SQL. We don't all like writing SQL code.

The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database. Each database able has a corresponding "Model" which is used to interact with that table.
			    $users = User::all();

			    $user = User::find(1);
			    var_dump($user->name);
			    
			    $model = User::findOrFail(1);
			    
			    $model = User::where('votes', '>', 100)->firstOrFail();
				

Quick Demo

Laravel Crud Project

Simple projects

(for tutorials see maxoffsky.com) :-)

Laravel Communities

LaravelPH on GitHub Laravel group Follow us on Twitter

Open-source

Websites/services

BeSnappy.com - customer support (currently stopped) FortRabbit - Laravel hosting

Stellar Sources

  • History: http://maxoffsky.com/code-blog/history-of-laravel-php-framework-eloquence-emerging/ by Maksim Surguy
  • List of laravel projects: https://gist.github.com/msurguy/8590765 by Maksim Surguy