Laravel Introduction PDF

Summary

This document provides an introduction to Laravel, a popular PHP web framework. It discusses the history behind its creation and its evolution. It also highlights key features like the MVC architecture, Eloquent ORM, and Composer.

Full Transcript

Introdu ction to “The PHP Framework For Web Artisans" HISTORY BEHIND THE VISION Taylor Otwell, a.NET developer in Arkansas (USA), was using an early version of Codeigniter when the idea for Laravel came to him. “I couldn't add all the features I wante...

Introdu ction to “The PHP Framework For Web Artisans" HISTORY BEHIND THE VISION Taylor Otwell, a.NET developer in Arkansas (USA), was using an early version of Codeigniter when the idea for Laravel came to him. “I couldn't add all the features I wanted to”, he says, "without mangling the internal code of the framework”. He wanted something leaner, simpler, and more flexible. HISTORY BEHIND THE VISION Those desires, coupled with Taylor's.NET background, spawned the framework that would become Laravel. He used the ideas of the.NET infrastructure which Microsoft had built and spent hundreds of millions of dollars of research on. With Laravel, Taylor sought to create a framework that would be known for its simplicity. ❑ He added to that simplicity by including an expressive syntax, clear structure, and incredibly thorough documentation. With that, Laravel was born. THE EVOLUTION OF LARAVEL Taylor started with a simple routing layer and a really simple controller-type interface (MVC) v1 and v2 were released in June 2011 and September 2011 respectively, just months apart In February 2012, Laravel 3 was released just over a year later and this is when Laravel's user base and popularity really began to grow. THE EVOLUTION OF LARAVEL In May 2013, Laravel 4 was released as a complete rewrite of the framework and incorporated a package manager called Composer. Composer is an application-level package manager for PHP that allowed people to collaborate instead of compete. Before Composer, there was no way to take two separate packages and use different pieces of those packages together to create a single solution. Laravel is built on top of several packages most notably Symfony. MVC is a software architectural pattern commonly used for developing user interface that divide the related program logic into three interconnected elements. What is Laravel? a PHP framework inspired by Ruby on Rails In the beginning Laravel name was Bootplant then turned Laravel. Laravel name came from a castle which is Cair Paravel. The source code of Laravel is hosted on GitHub and licensed under the terms of MIT License Uses Symfony packages Free open-source license with many contributors worldwide Uses MVC PHP Framework Version Release date PHP version 1.0 June 2011 2.0 September 2011 3.0 February 22, 2012 3.1 March 27, 2012 3.2 May 22, 2012 4.0 May 28, 2013 ≥ 5.3.0 4.1 December 12, 2013 ≥ 5.3.0 4.2 June 1, 2014 ≥ 5.4.0 5.0 February 4, 2015 ≥ 5.4.0 5.1 LTS June 9, 2015 ≥ 5.5.9 5.2 December 21, 2015 ≥ 5.5.9 5.3 August 23, 2016 ≥ 5.6.4 5.4 January 24, 2017 ≥ 5.6.4 5.5 LTS August 30, 2017 ≥ 7.0.0 5.6 February 7, 2018 ≥ 7.1.3 5.7 September 4, 2018 ≥ 7.1.3 5.8 February 26, 2019 ≥ 7.1.3 6 LTS September 3, 2019 7.2 – 8.0 7 March 3, 2020 7.2 – 8.0 8 September 8, 2020 7.3 – 8.1 9 February 8, 2022 8.0 – 8.1 10 February 14, 2023 ≥ 8.1 11 Q1 2024 ≥ 8.2 LARAVEL TODAY Laravel now stands at version 10 with 11 currently in development Support for PHP 7 has recently been added to Laravel 7.3 - 8.1. Server Requirements PHP >= 7.2.5 BCMath PHP Extension Ctype PHP Extension Fileinfo PHP extension JSON PHP Extension Mbstring PHP Extension OpenSSL PHP Extension PDO PHP Extension Tokenizer PHP Extension XML PHP Extension Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine. I. Download and install Composer II. Open CMD and paste the syntax: composer global require laravel/installer Eloquent ORM (object-relational mapping) - implements Active-Record Query builder - helps you to build secured SQL queries Restful controllers - provides a way for separating the different HTTP requests (GET, POST, DELETE, etc.) Blade template engine - combines templates with a data model to produce views Migrations - version control system for database, update your database easier ARCHITECTURE Model Everything database related - Eloquent ORM (Object Relational Mapper) View HTML structure - Blade templating engine Controller Processing requests and generating output + Facades, Dependency Injection, Repositories, etc... File Structure app/Http folder contains the Controllers, Middlewares and Kernel file All the models should be located in app/Models folder The service providers that are bootstrapping functions in our app are located in app/Providers folder All the config files are located in app/config folder database folder contains the Migrations, Seeder, and Factory. The public folder is the actual folder you are opening on the web server. All JS / CSS / Images / Uploads are located there. The resources folder contains all the translations, views and assets (SASS, LESS, JS) that are compiled into public folder. The routes folder contains all the routes for the project All the logs / cache files are located in storage folder The vendor folder contains all the composer packages (dependencies) ROUTES The route is a way of creating a request URL for your application. Routes (/routes) hold the application URLs web.php for web routes api.php for stateless requests console.php for Artisan commands Route::get('/post/{post}', function () { // })->name('post.show’); // Visiting '/' will return 'Hello World!' Route::get('/', function(){ return 'Hello World!'; }); 2. Route to appropriate Laravel Controller Routing 5 Render view in users browser Database CONTROLLERS Handle the logic required for processing requests Controllers are stored in the app/Http/Controllers directory

Use Quizgecko on...
Browser
Browser