php laravel framework'üne dalış
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.TRANSCRIPT
PHP LARAVEL FRAMEWORK’ÜNE DALIŞ
Emir KarşıyakalıDeveloper at EFabrika
!!!
github.com/emir twitter.com/emirkarsiyakali
linkedin.com/in/emirkarsiyakali !
Neden Laravel?• Composer • Routing • ORM (MySQL,
Postgres, SQL Server, SQLite)
• Blade Templating • CLI
• Symfony components • Communtiy • Red, green, refactor!
(PHPUnit) • Authentication • Cache, Events,
Queues
–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.”
Nasıl öğrenebilirim?• Dökümantasyon, API
• Laracasts
• Leanpub
KurulumPHP >= 5.3.7MCrypt PHP Extensioncomposer create-project laravel/laravel
MVC?
Routing• Route to closures
• Route to controllers
• Route to RESTful controllers
• Route to Resources
Routing
Route Grup, Filtreler
Route Model Binding
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
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.
Jeffrey’s Generator• Migrations
• Models
• Views
• Forms
• Seeds
• Resources
• Scaffolding
• Test
• Pivot Tables
https://github.com/JeffreyWay/Laravel-4-Generators
Controllers• Controller Filters
• RESTful Controllers (getProfile, postProfile)Route::controller
• Resource Controllers
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,
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.’);
Database• Running Queries
DB::select(‘select * from users where id = ?', array(1));
• Query BuilderDB::table('users')->where('name', ‘John')->first();
…Eloquentclass Post extends Eloquent {
}
EloquentSelecting Records
EloquentInserting Records
EloquentInserting Records
EloquentUpdating, Deleting Records
MongoDB?• MongoLidclass User extends MongoLid { protected $collection = 'users'; }https://github.com/Zizaco/mongolid-laravel
Questions?
Koding
https://koding.com/Apps/laravel-1 https://github.com/emir/Laravel.kdapp
Teşekkürler!