{"id":5394,"date":"2021-03-03T07:08:14","date_gmt":"2021-03-03T07:08:14","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5394"},"modified":"2021-03-03T09:28:58","modified_gmt":"2021-03-03T09:28:58","slug":"introduction-to-laravel-2","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/","title":{"rendered":"Introduction to Laravel"},"content":{"rendered":"\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>What is Laravel?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Laravel is PHP framework, which is easy to understand and robust and open source also. It also offer the rich set of functionalities that incorporates the basic features of PHP framework such as Codelgniter, yii, and other programming languages like Ruby on Rails. It is a PHP framework that uses the MVC architecture.<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>MVC vs NON-MVC<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Let&#8217;s first understand the MVC architecture.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>MVC stands for Model-View Controller. It is a software design pattern by which creation of huge applications becomes easy. It does not belong to specific programming language or framework, but it is a concept that you can use creating any kind of application or software in any programming language.<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>Advantages:<\/strong><strong><em><\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Easy to update the application.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Easy for the developers to collaborate and wor together.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>East to debug because of multilevel properly written application.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Development becomes fast.<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>Disadvantages<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>MVC architecture is little bit difficult to understand.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Setting up laravel project:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>How to set up a Laravel Project<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Setting up laravel project is very easy task.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>First we need to install composer and xampp in our system. The open command prompt in xampp\\htdocs&nbsp; file.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>Install laravel there. The command to install laravel is \u2013 composer global require \u201claravel\/installer=~1.1\u201d (NOTE= 1.1 is a larvael version)<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>After installation of laravel we need to create a project. The command to a&nbsp; create project is- composer create-project\u2014prefer-dist laravel\/laravel blog\u201d5.8.*\u201d (NOTE: blog is name of the project, so we can give any name.)<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>Understanding the folder structure:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>After the laravel project is created, different types of files and folders are created. All the files and folder help us in writing codes<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>List of folders created<em>:<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>1.App<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>2. Bootstrap<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>3. Config<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>4.Database<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>5. Public<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>6.Resources<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>7.Routes<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>8. Storage<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>9. Tests<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>10. vendor<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color wp-block-paragraph\"><strong>1. APP:-<\/strong><strong><em> The app directory contains the base code of the application.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. Bootstrap:- <em>The bootstrap directory containd all the app.php files and bootstrapping\u00a0scripts uded for the application. In this directory there is cache directory which contains framework generated files for performance optimization such as the route and services cache files.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3.Config:-<\/strong><strong><em> As the name implies, this directory contains all the configuration files.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. Database:- <\/strong><strong><em>Database directory contains all the Database files.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>5. Public:- <\/strong><strong><em>In public directory contains the index.php file, which is the entry point for all request entering the application and configures the autoloading. This directory maintains all the other important files like&nbsp; Javascript, CSS and images.<\/em><\/strong><strong>&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>6.Resources<\/strong><strong><em>:- Resources directory contains the views and&nbsp; un-compiled assets like CSS and JavaScript. It also contains language files, sas files and templetes(if any).<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>7.Routes:-<\/strong><strong><em>In routes directory all the laravel routes are defined in routes file. It contain the definition files for routing such as api.php, wed.php etc.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>8. Storage:- <\/strong><strong><em>The storage directory contains file based sessions, file caches, compiled blade templates and many other files which are created by the framework. This is segregated into framework, app and logs directories.<\/em><\/strong><strong><em><\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>9. Tests:- Test directories holds all the test cases.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>10. Vendor:- The vendor directory holds all composer dependency files.<\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>A Quick intro to the Artisian Command line Interface<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;<\/strong><strong><em>Artisian is a command line interface which is &nbsp;frequently used in laravel and it have set of helpful commands for developing a web application.<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color wp-block-paragraph\"><strong>Few commands of Artisian:-<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li><strong>php artisian server (To start Laravel project)<\/strong><\/li><li><strong>php artisian route:cache (To enable caching mechanism)<\/strong><\/li><li><strong>php artisian list (To view the lit of available commands supported by Artisian)<\/strong><\/li><li><strong>php artisian help serve (to view help about any command and view the available options and arguments)<\/strong><\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Laravel? Laravel is PHP framework, which is easy to understand and robust and open source also. It also [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5394","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Introduction to Laravel - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to Laravel - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"What is Laravel? Laravel is PHP framework, which is easy to understand and robust and open source also. It also [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-03T07:08:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-03T09:28:58+00:00\" \/>\n<meta name=\"author\" content=\"shashank K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"shashank K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/\"},\"author\":{\"name\":\"shashank K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/c88b513657ea9e9a6cd8a9b3a3bff6f3\"},\"headline\":\"Introduction to Laravel\",\"datePublished\":\"2021-03-03T07:08:14+00:00\",\"dateModified\":\"2021-03-03T09:28:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/\"},\"wordCount\":597,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/\",\"name\":\"Introduction to Laravel - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-03-03T07:08:14+00:00\",\"dateModified\":\"2021-03-03T09:28:58+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/c88b513657ea9e9a6cd8a9b3a3bff6f3\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/introduction-to-laravel-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction to Laravel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/c88b513657ea9e9a6cd8a9b3a3bff6f3\",\"name\":\"shashank K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a1d7da7c43d650339f6ab219ed52f462ee8ce994ce0d45b50c0700eead0676a4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a1d7da7c43d650339f6ab219ed52f462ee8ce994ce0d45b50c0700eead0676a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a1d7da7c43d650339f6ab219ed52f462ee8ce994ce0d45b50c0700eead0676a4?s=96&d=mm&r=g\",\"caption\":\"shashank K\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/shashank\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Introduction to Laravel - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to Laravel - scmGalaxy","og_description":"What is Laravel? Laravel is PHP framework, which is easy to understand and robust and open source also. It also [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/","og_site_name":"scmGalaxy","article_published_time":"2021-03-03T07:08:14+00:00","article_modified_time":"2021-03-03T09:28:58+00:00","author":"shashank K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"shashank K","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/"},"author":{"name":"shashank K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/c88b513657ea9e9a6cd8a9b3a3bff6f3"},"headline":"Introduction to Laravel","datePublished":"2021-03-03T07:08:14+00:00","dateModified":"2021-03-03T09:28:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/"},"wordCount":597,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/","name":"Introduction to Laravel - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-03-03T07:08:14+00:00","dateModified":"2021-03-03T09:28:58+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/c88b513657ea9e9a6cd8a9b3a3bff6f3"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/introduction-to-laravel-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Introduction to Laravel"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/c88b513657ea9e9a6cd8a9b3a3bff6f3","name":"shashank K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a1d7da7c43d650339f6ab219ed52f462ee8ce994ce0d45b50c0700eead0676a4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a1d7da7c43d650339f6ab219ed52f462ee8ce994ce0d45b50c0700eead0676a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a1d7da7c43d650339f6ab219ed52f462ee8ce994ce0d45b50c0700eead0676a4?s=96&d=mm&r=g","caption":"shashank K"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/shashank\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5394"}],"version-history":[{"count":3,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5394\/revisions"}],"predecessor-version":[{"id":5400,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5394\/revisions\/5400"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}