{"id":341512,"date":"2021-09-19T20:00:00","date_gmt":"2021-09-19T17:00:00","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/what-is-laravel-and-how-do-you-get-started-with-it-cloudsavvy-it\/"},"modified":"2021-09-19T20:00:00","modified_gmt":"2021-09-19T17:00:00","slug":"what-is-laravel-and-how-do-you-get-started-with-it-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/what-is-laravel-and-how-do-you-get-started-with-it-cloudsavvy-it\/","title":{"rendered":"#What Is Laravel, And How Do You Get Started with It? \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2d4c82efa2c\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2d4c82efa2c\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-laravel-and-how-do-you-get-started-with-it-cloudsavvy-it\/#What_Is_Laravel_Used_for\" >What Is Laravel Used for?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-laravel-and-how-do-you-get-started-with-it-cloudsavvy-it\/#How_Does_Laravel_Work\" >How Does Laravel Work?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-laravel-and-how-do-you-get-started-with-it-cloudsavvy-it\/#How_to_Get_Started\" >How to Get Started<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#What Is Laravel, And How Do You Get Started with It? \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage imgchk9 alignnone wp-image-1543 size-full\" srcset=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/08\/9f2540e5.png?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/08\/9f2540e5.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/08\/9f2540e5.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Laravel logo\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Laravel is a web framework for making custom <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lications. It runs on PHP, and is entirely free and open source. We\u2019ll discuss what makes this framework a good choice, and why you might want to base your app on it.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"What_Is_Laravel_Used_for\"><\/span>What Is Laravel Used for?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/\">Laravel<\/a> is primarily used for building custom web apps using PHP. It\u2019s a web framework that handles many things that are annoying to build yourself, such as routing, templating HTML, and authentication.<\/p>\n<p>Laravel is entirely server-side, due to running on PHP, and focuses heavily on data manipulation and sticking to a\u00a0Model-View-Controller design. A framework like React might put most of its attention on user interaction and shiny features, but Laravel simply presents a solid foundation for you to build off of\u2014and does it right.<\/p>\n<p>Laravel is one of the best PHP web frameworks, but there are many other frameworks in different languages. <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/rubyonrails.org\/\">Rails<\/a>\u00a0is another server-side rendered framework, similar to Laravel, but based on Ruby. <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/reactjs.org\/\">React<\/a>, <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/vuejs.org\/\">Vue<\/a>, and <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/angular.io\/\">Angular<\/a> are all client-side JavaScript frameworks but can be configured to render server-side as well.<\/p>\n<p>Alternatively, if you application leans towards a blog style with multiple text-based posts, you could base it off of <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/wordpress.org\/\">WordPress<\/a>, which also runs on PHP. But Laravel doesn\u2019t force you to use features you don\u2019t want, it just gives you the tools to build something like WordPress by yourself.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"How_Does_Laravel_Work\"><\/span>How Does Laravel Work?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Laravel uses a design pattern called Model-View-Controller, or MVC.<\/p>\n<p>The \u201cModel\u201d represents the shape of the data your application operates on. If you have a table of users, each with a list of posts they\u2019ve made, that\u2019s your model.<\/p>\n<p>The \u201cController\u201d interacts with this model. If a user requests to see their posts page, the controller talks to the model (often just the database) and retrieves the info. If the user wants to make a new post, the controller updates the model. The controller contains most of the logic for your application.<\/p>\n<p>The controller uses that info to construct a \u201cView.\u201d The view is a template with which the model can be plugged into and displayed, and it can be manipulated by the controller. The view is all your application\u2019s HTML components.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-1536 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/08\/3b3431f3-9.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"The Model-View-Controller\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Laravel uses this structure to power custom apps. It uses the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/5.8\/blade\">Blade templating engine<\/a>, which allows HTML to be broken into pieces and managed by the controller. It all starts with <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/5.8\/routing\">routes<\/a>, defined in <code>routes\/web.php<\/code>, that handle HTTP requests based on the location being requested. For example, the following function would run if a user requested <code>https:\/\/yoursite.com\/greeting<\/code>:<\/p>\n<pre>Route::get('\/greeting', function () {&#13;\n\u00a0 return view('greeting', ['name' =&gt; 'James']);&#13;\n});<\/pre>\n<p>This route executes a function that returns a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/5.8\/views\">view<\/a>\u00a0from <code>resources\/views\/<\/code>. The view has been passed data (the <code>name<\/code>\u00a0variable), which it can use inside the markup:<\/p>\n<pre>&lt;!-- View stored in resources\/views\/greeting.blade.php --&gt;&#13;\n&#13;\n&lt;html&gt;&#13;\n    &lt;body&gt;&#13;\n        &lt;h1&gt;Hello, {{ $name }}&lt;\/h1&gt;&#13;\n    &lt;\/body&gt;&#13;\n&lt;\/html&gt;<\/pre>\n<p>This is as simple as it gets, but a lot can happen in between the request and the return of a view. Laravel supports <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/5.8\/middleware\">middleware<\/a>, which will run before the request is handled. You could use this to lock down certain pages by checking if a user is authenticated before a request is handled.<\/p>\n<p>Instead of showing a view directly, you can also pass the request off to a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/5.8\/controllers\">controller<\/a>, which can handle more complex logic before ultimately returning some resource (often a view). You can read more about the inner workings of the Laravel framework in <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/docs\/5.8\/\">their docs.<\/a><\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"How_to_Get_Started\"><\/span>How to Get Started<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Laravel runs on PHP, which means all you need is a web server like Apache or Nginx with <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.php.net\/manual\/en\/install.php\">PHP installed<\/a>. You\u2019ll also need <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/getcomposer.org\/\">Composer<\/a>, a dependency manager for PHP, and you\u2019ll need a database.\u00a0<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/dev.mysql.com\/doc\/mysql-installation-excerpt\/5.7\/en\/\">MySQL<\/a> will work fine, but PostgreSQL and SQLite are supported as well.<\/p>\n<p>Once the dependencies are installed, you can download and install Laravel from Composer:<\/p>\n<pre>composer global require laravel\/installer<\/pre>\n<p>This is technically just the Laravel installer, so you\u2019ll need to create a new Laravel installation using <code>laravel new<\/code>:<\/p>\n<pre>laravel new blog<\/pre>\n<p>This creates a new directory named \u201cblog\u201d and installs Laravel to it. This contains a built-in <code>.htaccess<\/code>\u00a0file, so all you\u2019ll have to do is <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/httpd.apache.org\/docs\/2.4\/howto\/htaccess.html\">make sure <code>mod_rewrite<\/code>\u00a0is turned on<\/a> to enable <code>.htaccess<\/code>\u00a0files, and point Apache towards the directory. Alternatively, if you\u2019d just like to get it off the ground, you can use PHP\u2019s built-in Artisan server by running the following command in the project directory:<\/p>\n<pre>php artisan serve<\/pre>\n<p>This launches a development server at <code>localhost:8000<\/code>. If it\u2019s running on a server, you\u2019ll have to open that port or use <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.howtogeek.com\/168145\/how-to-use-ssh-tunneling\/\">SSH tunnelling<\/a> to access it. This isn\u2019t a proper web server though, so you\u2019ll still want <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.apache.org\/\">Apache<\/a> or <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.nginx.com\/\">Nginx<\/a> for production.\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/1535\/what-is-laravel-and-how-do-you-get-started-with-it\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#What Is Laravel, And How Do You Get Started with It? \u2013 CloudSavvy IT&#8221; Laravel is a web framework for making custom applications. It runs on PHP, and is entirely free and open source. We\u2019ll discuss what makes this framework a good choice, and why you might want to base your app on it. What&#8230;<\/p>\n","protected":false},"author":1,"featured_media":341513,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/08\/9f2540e5.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-341512","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/341512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=341512"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/341512\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/341513"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=341512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=341512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=341512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}