Introduction to Laravel
ABOUT ME
• Started with PHP in 2000
• Experience with Java, ASP, C++, etc...
• Freelance web developer since 2009
• Mostly...
WHAT IS LARAVEL
“...we’ve attempted to combine the very best of what we
have seen in other web frameworks, including frame...
BETTER THAN THE REST?
• Authentication
• Routing
• Sessions
• Packages (Called Bundles in L3)
• Command-line utility (Arti...
REQUIREMENTS
• PHP >= 5.3.7
• MCrypt PHP Extension
• PHP 5.5 may need PHP JSON Extension
• Composer to manage dependencies
COMPOSER
The problem that Composer solves is this:
a) You have a project that depends on a number of libraries.
b) Some of...
GETTING STARTED
composer create-project laravel/laravel --prefer-dist

Make app/storage writable, that’s pretty much it
REQUEST LIFECYCLE
Request
Route

Start Files

Controller

Events

Model
View

Filters
ROUTING
• GET
• POST
• PUT
• DELETE
• ANY
• Filters (auth)
CONTROLLERS
• Better organization
• All controllers extend BaseController
• Shared logic goes in BaseController
• Dependen...
VIEWS (BLADE)
• Contain your HTML
• Separate controller logic from presentation logic
• Build your own or use Blade
• @sec...
ELOQUENT ORM
class User extends Eloquent {
protected $table = 'my_users';
}
$users = User::all();
$user = User::find(123);
INSERT, UPDATE, DELETE
$user = new User;
$user->name = 'John';
$user->save();
$user = User::find(123);
$user->email = 'john...
RELATIONSHIPS
• One To One
• One To Many
• Many To Many
• Polymorphic Relations
OTHER COOL STUFF
• Timestamps
• Eager loading
• Accessors & Mutators
• Model Events
• Converting To Arrays / JSON
• and mo...
MIGRATIONS
• Version control for you database
• Paired with Schema builder
• Run with Artisan
UNIT TESTING
• Supports PHPUnit out of the box
• Easy to get started with Composer
• Allows you to simulate a web browser
THANK YOU!
@eliwheaton
facebook.com/eliwheaton
http://eliwheaton.com
Other Resources:
codehappy.daylerees.com (L3)
codebri...
Upcoming SlideShare
Loading in...5
×

Introduction to Laravel

2,000

Published on

This is a basic introduction to the Laravel PHP framework. Provided by the Tampa Bay Laravel meetup group.

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,000
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
88
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Introduction to Laravel

  1. 1. Introduction to Laravel
  2. 2. ABOUT ME • Started with PHP in 2000 • Experience with Java, ASP, C++, etc... • Freelance web developer since 2009 • Mostly CodeIgniter and Wordpress • Started the Laravel meet up to bring devs together and help the framework gain traction in Tampa Bay
  3. 3. WHAT IS LARAVEL “...we’ve attempted to combine the very best of what we have seen in other web frameworks, including frameworks implemented in other languages, such as Ruby on Rails, ASP.NET MVC, and Sinatra.”
  4. 4. BETTER THAN THE REST? • Authentication • Routing • Sessions • Packages (Called Bundles in L3) • Command-line utility (Artisan) • Eloquent ORM • Migrations • Unit-Testing • Well tested, over 900 tests on core Use what makes sense for your project!
  5. 5. REQUIREMENTS • PHP >= 5.3.7 • MCrypt PHP Extension • PHP 5.5 may need PHP JSON Extension • Composer to manage dependencies
  6. 6. COMPOSER The problem that Composer solves is this: a) You have a project that depends on a number of libraries. b) Some of those libraries depend on other libraries. c) You declare the things you depend on. d) Composer finds out which versions of which packages need to be installed, and installs them (meaning it downloads them into your project). https://packagist.org
  7. 7. GETTING STARTED composer create-project laravel/laravel --prefer-dist Make app/storage writable, that’s pretty much it
  8. 8. REQUEST LIFECYCLE Request Route Start Files Controller Events Model View Filters
  9. 9. ROUTING • GET • POST • PUT • DELETE • ANY • Filters (auth)
  10. 10. CONTROLLERS • Better organization • All controllers extend BaseController • Shared logic goes in BaseController • Dependency injection
  11. 11. VIEWS (BLADE) • Contain your HTML • Separate controller logic from presentation logic • Build your own or use Blade • @section and @parent • Passing variables
  12. 12. ELOQUENT ORM class User extends Eloquent { protected $table = 'my_users'; } $users = User::all(); $user = User::find(123);
  13. 13. INSERT, UPDATE, DELETE $user = new User; $user->name = 'John'; $user->save(); $user = User::find(123); $user->email = 'john@foo.com'; $user->save(); $user->delete();
  14. 14. RELATIONSHIPS • One To One • One To Many • Many To Many • Polymorphic Relations
  15. 15. OTHER COOL STUFF • Timestamps • Eager loading • Accessors & Mutators • Model Events • Converting To Arrays / JSON • and more...
  16. 16. MIGRATIONS • Version control for you database • Paired with Schema builder • Run with Artisan
  17. 17. UNIT TESTING • Supports PHPUnit out of the box • Easy to get started with Composer • Allows you to simulate a web browser
  18. 18. THANK YOU! @eliwheaton facebook.com/eliwheaton http://eliwheaton.com Other Resources: codehappy.daylerees.com (L3) codebright.daylerees.com (L4) culttt.com net.tutsplus.com Let’s keep the meetups going!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×