SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
1
Getting started with
Laravel
Presenter :
Nikhil Agrawal
Mindfire Solutions
Date: 22nd April, 2014
2
Zend PHP 5.3 Certified
OCA-1z0-870 - MySQL 5 Certified
DELF-A1-French Certified
Skills: Laravel, cakePHP, Codeigniter, Mysql, Jquery, HTML,
css
About me
Presenter: Nikhil Agrawal, Mindfire Solutions
Connect Me:
https://www.facebook.com/nkhl.agrawal
http://in.linkedin.com/pub/nikhil-agrawal/33/318/21b/
https://twitter.com/NikhilAgrawal44
Contact Me:
Email: nikhila@mindfiresolutions.com, nikhil_agrawal@live.com
Skype: mfsi_nikhila
3
Content
✔ Introduction
✔ Features
✔ Setup
✔ Artisan CLI
✔ Routing
✔ Controller, Model, View (MVC)
✔ Installing packages
✔ Migration
✔ Error & Logging
✔ References & QA
Presenter: Nikhil Agrawal, Mindfire Solutions
4
Introduction
✔ Started by Taylor Otwell (a c# developer).
✔ PHP V>= 5.3 based MVC framework.
✔ Hugely inspired by other web framework including
frameworks in other language such as ROR,
ASP.NET and Sinatra
✔ Composer-based
✔ Has a command line interface called as Artisan
✔ Current stable version available is 4.1
Presenter: Nikhil Agrawal, Mindfire Solutions
5
Features out-of-the-box
✔ Flexible routing
✔ Powerful ActiveRecord ORM
✔ Migration and seeding
✔ Queue driver
✔ Cache driver
✔ Command-Line Utility (Artisan)
✔ Blade Template
✔ Authentication driver
✔ Pagination, Mail drivers, unit testing and many more
Presenter: Nikhil Agrawal, Mindfire Solutions
6
Setup
✔ Install Composer
curl -sS https://getcomposer.org/installer | php
✔ It is a dependency manager
✔ What problem it solves?
✔ composer.json, composer.lock files
✔ Install laravel / create-project.
✔ Folder structure
✔ Request lifecycle
✔ Configuration
Presenter: Nikhil Agrawal, Mindfire Solutions
7
Artisan
✔ Artisan is a command-line interface tool to speed up
development process
✔ Commands
✔ List all commands : php artisan list
✔ View help for a commands : php artisan help migrate
✔ Start PHP server : php artisan serve
✔ Interact with app : php artisan tinker
✔ View routes : php artisan routes
✔ And many more...
Presenter: Nikhil Agrawal, Mindfire Solutions
8
Routing
✔ Basic Get/Post route
✔ Route with parameter & https
✔ Route to controller action
Route::get('/test', function() {
return 'Hello'
})
Route::get('/test/{id}', array('https', function() {
return 'Hello'
}));
Route::get('/test/{id}', array(
'uses' => 'UsersController@login',
'as' => 'login'
)
)
Presenter: Nikhil Agrawal, Mindfire Solutions
9
Routing cont..
✔ Route group and prefixes
✔ Route Model binding
✔ Url of route:
✔ $url = route('routeName', $param);
✔ $url = action('ControllerName@method', $param)
Route::group(array('before' => 'auth|admin', 'prefix' => 'admin'), function (){
//Different routes
})
Binding a parameter to model
Route::model('user_id', 'User');
Route::get('user/profile/{user_id}', function(User $user){
return $user->firstname . ' ' . $user->lastname
})
Presenter: Nikhil Agrawal, Mindfire Solutions
10
Controller
✔ Extends BaseController, which can be used to write logic
common througout application
✔ RESTful controller
✔ Defining route
Route::controller('users', 'UserController');
✔ Methods name is prefixed with get/post HTTP verbs
✔ Resource controller
✔ Creating using artisan
✔ Register in routes
✔ Start using it
Presenter: Nikhil Agrawal, Mindfire Solutions
11
Model
✔ Model are used to interact with database.
✔ Each model corresponds to a table in db.
✔ Two different ways to write queries
1. Using Query Builder
2. Using Eloquent ORM
Presenter: Nikhil Agrawal, Mindfire Solutions
12
Query Builder (Model)
✔ SELECT
✔
$users = DB::table('users')->get();
✔ INSERT
✔ $id = DB::table('user')
->insertGetId(array('email' =>'nikhila@mindfire.com',
'password' => 'mindfire'));
✔ UPDATE
✔ DB::table('users')
->where('active', '=', 0)
->update(array('active' => 1));
✔ DELETE
✔ DB::table('users')
->delete();
Presenter: Nikhil Agrawal, Mindfire Solutions
13
Eloquent ORM (Model)
✔ Defining a Eloquent model
✔ Class User Extends Eloquent { }
✔ Try to keep the table name plural and the respective model as singular (e.g
users / User)
✔ SELECT
✔ $user = User::find(1) //Using Primary key
✔ $user = User::findorfail(1) //Throws ModelNotFoundException if
no data is found
✔ $user = Menu::where('group', '=', 'admin')->remember(10)->get();
//Caches Query for 10 minutes
✔ INSERT
✔ $user_obj = new User();
$user_obj->name = 'nikhil';
$user_obj->save();
✔ $user = User::create(array('name' => 'nikhil'));
14
Query Scope (Eloquent ORM)
✔ Allow re-use of logic in model.
Presenter: Nikhil Agrawal, Mindfire Solutions
15
Many others Eloquent features..
✔ Defining Relationships
✔ Soft deleting
✔ Mass Assignment
✔ Model events
✔ Model observer
✔ Eager loading
✔ Accessors & Mutators
16
View (Blade Template)
Presenter: Nikhil Agrawal, Mindfire Solutions
17
Loops
View Composer
✔ View composers are callbacks or class methods that are called when
a view is rendered.
✔ If you have data that you want bound to a given view each time that
view is rendered throughout your application, a view composer can
organize that code into a single location
View::composer('displayTags', function($view)
{
$view->with('tags', Tag::all());
});
Presenter: Nikhil Agrawal, Mindfire Solutions
18
Installing packages
✔ Installing a new package:
✔ composer require <packageName> (Press Enter)
✔ Give version information
✔ Using composer.json/composer.lock files
✔ composer install
✔ Some useful packages
✔ Sentry 2 for ACL implementation
✔ bllim/datatables for Datatables
✔ Way/Generators for speedup development process
✔ barryvdh/laravel-debugbar
✔ Check packagist.org for more list of packages
Presenter: Nikhil Agrawal, Mindfire Solutions
19
Migration
Developer A
✔ Generate migration class
✔ Run migration up
✔ Commits file
Developer B
✔ Pull changes from scm
✔ Run migration up
1. Install migration
✔ php artisan migrate install
2. Create migration using
✔ php artisan migrate:make name
3. Run migration
✔ php artisan migrate
4. Refresh, Reset, Rollback migration
Presenter: Nikhil Agrawal, Mindfire Solutions
Steps
20
Error & Logging
✔ Enable/Disable debug error in app/config/app.php
✔ Configure error log in app/start/global.php
✔ Use Daily based log file or on single log file
✔ Handle 404 Error
App::missing(function($exception){
return Response::view('errors.missing');
});
✔ Handling fatal error
App::fatal(function($exception){
return "Fatal Error";
});
✔ Generate HTTP exception using
App:abort(403);
✔ Logging error
✔ Log::warning('Somehting is going wrong'); //Info,error
21
References
● http://laravel.com/docs (Official Documentation)
● https://getcomposer.org/doc/00-intro.md (composer)
● https://laracasts.com/ (Video tutorials)
● http://cheats.jesse-obrien.ca/ (Cheat Sheet)
● http://taylorotwell.com/
Presenter: Nikhil Agrawal, Mindfire Solutions
22
Questions ??
Presenter: Nikhil Agrawal, Mindfire Solutions
23
A Big
Thank you !
Presenter: Nikhil Agrawal, Mindfire Solutions
24
Connect Us @
www.mindfiresolutions.com
https://www.facebook.com/MindfireSolutions
http://www.linkedin.com/company/mindfire-
solutions
http://twitter.com/mindfires

Más contenido relacionado

La actualidad más candente

ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgnitermirahman
 
An introduction to Laravel Passport
An introduction to Laravel PassportAn introduction to Laravel Passport
An introduction to Laravel PassportMichael Peacock
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST APICaldera Labs
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overviewYehuda Katz
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsNeil Crookes
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockCaldera Labs
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCalderaLearn
 
Rails 3 Beautiful Code
Rails 3 Beautiful CodeRails 3 Beautiful Code
Rails 3 Beautiful CodeGreggPollack
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkJeremy Kendall
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutVic Metcalfe
 
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...Ville Mattila
 
Hacking hhvm
Hacking hhvmHacking hhvm
Hacking hhvmwajrcs
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkBo-Yi Wu
 
Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Rafael Felix da Silva
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressJeroen van Dijk
 

La actualidad más candente (20)

ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
An introduction to Laravel Passport
An introduction to Laravel PassportAn introduction to Laravel Passport
An introduction to Laravel Passport
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
Catalyst MVC
Catalyst MVCCatalyst MVC
Catalyst MVC
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
 
Rails 3 Beautiful Code
Rails 3 Beautiful CodeRails 3 Beautiful Code
Rails 3 Beautiful Code
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
 
Hacking hhvm
Hacking hhvmHacking hhvm
Hacking hhvm
 
Zend framework
Zend frameworkZend framework
Zend framework
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
 
Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
 

Destacado

Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCMindfire Solutions
 
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to pythonJiho Lee
 
라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘Jiho Lee
 
The Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.pyThe Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.pyTzu-ping Chung
 
NoSql Day - Apertura
NoSql Day - AperturaNoSql Day - Apertura
NoSql Day - AperturaWEBdeBS
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesMarkus Zapke-Gründemann
 
2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 Na Lee
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at PyconJacqueline Kazil
 
Django e il Rap Elia Contini
Django e il Rap Elia ContiniDjango e il Rap Elia Contini
Django e il Rap Elia ContiniWEBdeBS
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & PostgresqlLucio Grenzi
 

Destacado (20)

Reflection-In-PHP
Reflection-In-PHPReflection-In-PHP
Reflection-In-PHP
 
EuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein RückblickEuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein Rückblick
 
Digesting jQuery
Digesting jQueryDigesting jQuery
Digesting jQuery
 
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVC
 
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python
 
라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘
 
Load testing
Load testingLoad testing
Load testing
 
The Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.pyThe Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.py
 
Django-Queryset
Django-QuerysetDjango-Queryset
Django-Queryset
 
2 × 3 = 6
2 × 3 = 62 × 3 = 6
2 × 3 = 6
 
PythonBrasil[8] closing
PythonBrasil[8] closingPythonBrasil[8] closing
PythonBrasil[8] closing
 
NoSql Day - Apertura
NoSql Day - AperturaNoSql Day - Apertura
NoSql Day - Apertura
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
 
2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论
 
PyClab.__init__(self)
PyClab.__init__(self)PyClab.__init__(self)
PyClab.__init__(self)
 
Bottle - Python Web Microframework
Bottle - Python Web MicroframeworkBottle - Python Web Microframework
Bottle - Python Web Microframework
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at Pycon
 
Django e il Rap Elia Contini
Django e il Rap Elia ContiniDjango e il Rap Elia Contini
Django e il Rap Elia Contini
 
User-centered open source
User-centered open sourceUser-centered open source
User-centered open source
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & Postgresql
 

Similar a Getting Started-with-Laravel

SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsPhilip Stehlik
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and MaintenanceJazkarta, Inc.
 
Panmind at Ruby Social Club Milano
Panmind at Ruby Social Club MilanoPanmind at Ruby Social Club Milano
Panmind at Ruby Social Club MilanoPanmind
 
Let's build Developer Portal with Backstage
Let's build Developer Portal with BackstageLet's build Developer Portal with Backstage
Let's build Developer Portal with BackstageOpsta
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
Kubernetes walkthrough
Kubernetes walkthroughKubernetes walkthrough
Kubernetes walkthroughSangwon Lee
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
Ahmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICDAhmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICDShekh Muenuddeen
 
Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016John Napiorkowski
 
What the heck went wrong?
What the heck went wrong?What the heck went wrong?
What the heck went wrong?Andy McKay
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Katy Slemon
 
Working with AngularJS
Working with AngularJSWorking with AngularJS
Working with AngularJSAndré Vala
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009hugowetterberg
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)cgmonroe
 
OpenStack Rally presentation by RamaK
OpenStack Rally presentation by RamaKOpenStack Rally presentation by RamaK
OpenStack Rally presentation by RamaKRama Krishna B
 
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptx
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptxNew features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptx
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptxMuralidharan Deenathayalan
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JSBipin
 

Similar a Getting Started-with-Laravel (20)

SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
Panmind at Ruby Social Club Milano
Panmind at Ruby Social Club MilanoPanmind at Ruby Social Club Milano
Panmind at Ruby Social Club Milano
 
Let's build Developer Portal with Backstage
Let's build Developer Portal with BackstageLet's build Developer Portal with Backstage
Let's build Developer Portal with Backstage
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Kubernetes walkthrough
Kubernetes walkthroughKubernetes walkthrough
Kubernetes walkthrough
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Ahmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICDAhmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICD
 
Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016
 
What the heck went wrong?
What the heck went wrong?What the heck went wrong?
What the heck went wrong?
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)
 
Sprint 71
Sprint 71Sprint 71
Sprint 71
 
Working with AngularJS
Working with AngularJSWorking with AngularJS
Working with AngularJS
 
Pyramid patterns
Pyramid patternsPyramid patterns
Pyramid patterns
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
 
OpenStack Rally presentation by RamaK
OpenStack Rally presentation by RamaKOpenStack Rally presentation by RamaK
OpenStack Rally presentation by RamaK
 
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptx
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptxNew features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptx
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptx
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JS
 
Pyramid deployment
Pyramid deploymentPyramid deployment
Pyramid deployment
 

Más de Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Último

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Último (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Getting Started-with-Laravel

  • 1. 1 Getting started with Laravel Presenter : Nikhil Agrawal Mindfire Solutions Date: 22nd April, 2014
  • 2. 2 Zend PHP 5.3 Certified OCA-1z0-870 - MySQL 5 Certified DELF-A1-French Certified Skills: Laravel, cakePHP, Codeigniter, Mysql, Jquery, HTML, css About me Presenter: Nikhil Agrawal, Mindfire Solutions Connect Me: https://www.facebook.com/nkhl.agrawal http://in.linkedin.com/pub/nikhil-agrawal/33/318/21b/ https://twitter.com/NikhilAgrawal44 Contact Me: Email: nikhila@mindfiresolutions.com, nikhil_agrawal@live.com Skype: mfsi_nikhila
  • 3. 3 Content ✔ Introduction ✔ Features ✔ Setup ✔ Artisan CLI ✔ Routing ✔ Controller, Model, View (MVC) ✔ Installing packages ✔ Migration ✔ Error & Logging ✔ References & QA Presenter: Nikhil Agrawal, Mindfire Solutions
  • 4. 4 Introduction ✔ Started by Taylor Otwell (a c# developer). ✔ PHP V>= 5.3 based MVC framework. ✔ Hugely inspired by other web framework including frameworks in other language such as ROR, ASP.NET and Sinatra ✔ Composer-based ✔ Has a command line interface called as Artisan ✔ Current stable version available is 4.1 Presenter: Nikhil Agrawal, Mindfire Solutions
  • 5. 5 Features out-of-the-box ✔ Flexible routing ✔ Powerful ActiveRecord ORM ✔ Migration and seeding ✔ Queue driver ✔ Cache driver ✔ Command-Line Utility (Artisan) ✔ Blade Template ✔ Authentication driver ✔ Pagination, Mail drivers, unit testing and many more Presenter: Nikhil Agrawal, Mindfire Solutions
  • 6. 6 Setup ✔ Install Composer curl -sS https://getcomposer.org/installer | php ✔ It is a dependency manager ✔ What problem it solves? ✔ composer.json, composer.lock files ✔ Install laravel / create-project. ✔ Folder structure ✔ Request lifecycle ✔ Configuration Presenter: Nikhil Agrawal, Mindfire Solutions
  • 7. 7 Artisan ✔ Artisan is a command-line interface tool to speed up development process ✔ Commands ✔ List all commands : php artisan list ✔ View help for a commands : php artisan help migrate ✔ Start PHP server : php artisan serve ✔ Interact with app : php artisan tinker ✔ View routes : php artisan routes ✔ And many more... Presenter: Nikhil Agrawal, Mindfire Solutions
  • 8. 8 Routing ✔ Basic Get/Post route ✔ Route with parameter & https ✔ Route to controller action Route::get('/test', function() { return 'Hello' }) Route::get('/test/{id}', array('https', function() { return 'Hello' })); Route::get('/test/{id}', array( 'uses' => 'UsersController@login', 'as' => 'login' ) ) Presenter: Nikhil Agrawal, Mindfire Solutions
  • 9. 9 Routing cont.. ✔ Route group and prefixes ✔ Route Model binding ✔ Url of route: ✔ $url = route('routeName', $param); ✔ $url = action('ControllerName@method', $param) Route::group(array('before' => 'auth|admin', 'prefix' => 'admin'), function (){ //Different routes }) Binding a parameter to model Route::model('user_id', 'User'); Route::get('user/profile/{user_id}', function(User $user){ return $user->firstname . ' ' . $user->lastname }) Presenter: Nikhil Agrawal, Mindfire Solutions
  • 10. 10 Controller ✔ Extends BaseController, which can be used to write logic common througout application ✔ RESTful controller ✔ Defining route Route::controller('users', 'UserController'); ✔ Methods name is prefixed with get/post HTTP verbs ✔ Resource controller ✔ Creating using artisan ✔ Register in routes ✔ Start using it Presenter: Nikhil Agrawal, Mindfire Solutions
  • 11. 11 Model ✔ Model are used to interact with database. ✔ Each model corresponds to a table in db. ✔ Two different ways to write queries 1. Using Query Builder 2. Using Eloquent ORM Presenter: Nikhil Agrawal, Mindfire Solutions
  • 12. 12 Query Builder (Model) ✔ SELECT ✔ $users = DB::table('users')->get(); ✔ INSERT ✔ $id = DB::table('user') ->insertGetId(array('email' =>'nikhila@mindfire.com', 'password' => 'mindfire')); ✔ UPDATE ✔ DB::table('users') ->where('active', '=', 0) ->update(array('active' => 1)); ✔ DELETE ✔ DB::table('users') ->delete(); Presenter: Nikhil Agrawal, Mindfire Solutions
  • 13. 13 Eloquent ORM (Model) ✔ Defining a Eloquent model ✔ Class User Extends Eloquent { } ✔ Try to keep the table name plural and the respective model as singular (e.g users / User) ✔ SELECT ✔ $user = User::find(1) //Using Primary key ✔ $user = User::findorfail(1) //Throws ModelNotFoundException if no data is found ✔ $user = Menu::where('group', '=', 'admin')->remember(10)->get(); //Caches Query for 10 minutes ✔ INSERT ✔ $user_obj = new User(); $user_obj->name = 'nikhil'; $user_obj->save(); ✔ $user = User::create(array('name' => 'nikhil'));
  • 14. 14 Query Scope (Eloquent ORM) ✔ Allow re-use of logic in model. Presenter: Nikhil Agrawal, Mindfire Solutions
  • 15. 15 Many others Eloquent features.. ✔ Defining Relationships ✔ Soft deleting ✔ Mass Assignment ✔ Model events ✔ Model observer ✔ Eager loading ✔ Accessors & Mutators
  • 16. 16 View (Blade Template) Presenter: Nikhil Agrawal, Mindfire Solutions
  • 17. 17 Loops View Composer ✔ View composers are callbacks or class methods that are called when a view is rendered. ✔ If you have data that you want bound to a given view each time that view is rendered throughout your application, a view composer can organize that code into a single location View::composer('displayTags', function($view) { $view->with('tags', Tag::all()); }); Presenter: Nikhil Agrawal, Mindfire Solutions
  • 18. 18 Installing packages ✔ Installing a new package: ✔ composer require <packageName> (Press Enter) ✔ Give version information ✔ Using composer.json/composer.lock files ✔ composer install ✔ Some useful packages ✔ Sentry 2 for ACL implementation ✔ bllim/datatables for Datatables ✔ Way/Generators for speedup development process ✔ barryvdh/laravel-debugbar ✔ Check packagist.org for more list of packages Presenter: Nikhil Agrawal, Mindfire Solutions
  • 19. 19 Migration Developer A ✔ Generate migration class ✔ Run migration up ✔ Commits file Developer B ✔ Pull changes from scm ✔ Run migration up 1. Install migration ✔ php artisan migrate install 2. Create migration using ✔ php artisan migrate:make name 3. Run migration ✔ php artisan migrate 4. Refresh, Reset, Rollback migration Presenter: Nikhil Agrawal, Mindfire Solutions Steps
  • 20. 20 Error & Logging ✔ Enable/Disable debug error in app/config/app.php ✔ Configure error log in app/start/global.php ✔ Use Daily based log file or on single log file ✔ Handle 404 Error App::missing(function($exception){ return Response::view('errors.missing'); }); ✔ Handling fatal error App::fatal(function($exception){ return "Fatal Error"; }); ✔ Generate HTTP exception using App:abort(403); ✔ Logging error ✔ Log::warning('Somehting is going wrong'); //Info,error
  • 21. 21 References ● http://laravel.com/docs (Official Documentation) ● https://getcomposer.org/doc/00-intro.md (composer) ● https://laracasts.com/ (Video tutorials) ● http://cheats.jesse-obrien.ca/ (Cheat Sheet) ● http://taylorotwell.com/ Presenter: Nikhil Agrawal, Mindfire Solutions
  • 22. 22 Questions ?? Presenter: Nikhil Agrawal, Mindfire Solutions
  • 23. 23 A Big Thank you ! Presenter: Nikhil Agrawal, Mindfire Solutions