28
PHP LARAVEL FRAMEWORK’ÜNE DALI

PHP Laravel Framework'üne Dalış

Embed Size (px)

DESCRIPTION

Özgür Web Günleri 2013'de yaptığım sunum. Üzerinden geçtiğimiz örnek uygulama: https://github.com/emir/OWG2013-Sample-Laravel-App Video kaydının linki eklenecektir.

Citation preview

Page 1: PHP Laravel Framework'üne Dalış

PHP LARAVEL FRAMEWORK’ÜNE DALIŞ

Page 2: PHP Laravel Framework'üne Dalış

Emir KarşıyakalıDeveloper at EFabrika

!!!

github.com/emir twitter.com/emirkarsiyakali

linkedin.com/in/emirkarsiyakali !

[email protected]

Page 3: PHP Laravel Framework'üne Dalış

Neden Laravel?• Composer • Routing • ORM (MySQL,

Postgres, SQL Server, SQLite)

• Blade Templating • CLI

• Symfony components • Communtiy • Red, green, refactor!

(PHPUnit) • Authentication • Cache, Events,

Queues

Page 4: PHP Laravel Framework'üne Dalış

–Taylor Otwell

“Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication,

routing, sessions, and caching.”

Page 5: PHP Laravel Framework'üne Dalış

Nasıl öğrenebilirim?• Dökümantasyon, API

• Laracasts

• Leanpub

Page 6: PHP Laravel Framework'üne Dalış

KurulumPHP >= 5.3.7MCrypt PHP Extensioncomposer create-project laravel/laravel

Page 7: PHP Laravel Framework'üne Dalış

MVC?

Page 8: PHP Laravel Framework'üne Dalış

Routing• Route to closures

• Route to controllers

• Route to RESTful controllers

• Route to Resources

Page 9: PHP Laravel Framework'üne Dalış

Routing

Page 10: PHP Laravel Framework'üne Dalış

Route Grup, Filtreler

Page 11: PHP Laravel Framework'üne Dalış

Route Model Binding

Page 12: PHP Laravel Framework'üne Dalış

Artisan• Komutları görüntüleme

php artisan list

• Geliştirme ortamını çalıştırma php artisan serve

• Etkileşimli kabukphp artisan tinker

• Controller üretmekindex, create, store, show, edit, update, destroyphp artisan controller:make

Page 13: PHP Laravel Framework'üne Dalış

Artisan• Migration oluşturmak

php artisan migrate

• Database seeding php artisan db:seed

• Kuyruğu dinlemek php artisan queue:listen

• Route list php artisan routes

• 3rd party, sizin geliştirmelerinizphp artisan whatever the hell you want.

Page 14: PHP Laravel Framework'üne Dalış

Jeffrey’s Generator• Migrations

• Models

• Views

• Forms

• Seeds

• Resources

• Scaffolding

• Test

• Pivot Tables

https://github.com/JeffreyWay/Laravel-4-Generators

Page 15: PHP Laravel Framework'üne Dalış

Controllers• Controller Filters

• RESTful Controllers (getProfile, postProfile)Route::controller

• Resource Controllers

Page 16: PHP Laravel Framework'üne Dalış

Views & Responses• Basic Responses

Returning strings

• RedirectsRedirect::to('user/login')->with('message', 'Login Failed’);

• Views View::make('greeting', array('name' => ‘Emir'));

• Special Responses Response::json, Response::download,

Page 17: PHP Laravel Framework'üne Dalış

Errors & Logging• debug

app/config/app.phpdefault => true

• HTTP Exceptionsapp:abort(‘code’, ‘message’);

• Logging (debug, info, notice, warning, error, critical, and alert.)Log::info(‘Lorem ipsum dolor sit amet.’);

Page 18: PHP Laravel Framework'üne Dalış

Database• Running Queries

DB::select(‘select * from users where id = ?', array(1));

• Query BuilderDB::table('users')->where('name', ‘John')->first();

Page 19: PHP Laravel Framework'üne Dalış

…Eloquentclass Post extends Eloquent {

}

Page 20: PHP Laravel Framework'üne Dalış
Page 21: PHP Laravel Framework'üne Dalış

EloquentSelecting Records

Page 22: PHP Laravel Framework'üne Dalış

EloquentInserting Records

Page 23: PHP Laravel Framework'üne Dalış

EloquentInserting Records

Page 24: PHP Laravel Framework'üne Dalış

EloquentUpdating, Deleting Records

Page 25: PHP Laravel Framework'üne Dalış

MongoDB?• MongoLidclass User extends MongoLid { protected $collection = 'users'; }https://github.com/Zizaco/mongolid-laravel

Page 26: PHP Laravel Framework'üne Dalış

Questions?

Page 27: PHP Laravel Framework'üne Dalış

Koding

https://koding.com/Apps/laravel-1 https://github.com/emir/Laravel.kdapp

Page 28: PHP Laravel Framework'üne Dalış

Teşekkürler!