Bài giảng Phát triển phần mềm nguồn mở - Bài 6: Laravel - Nguyễn Hữu Thể

Laravel

− A powerful MVC PHP framework

− Designed for developers who need a simple and

elegant toolkit to create full-featured web

applications.

− Laravel was created by Taylor Otwell.

pdf 15 trang yennguyen 9220
Bạn đang xem tài liệu "Bài giảng Phát triển phần mềm nguồn mở - Bài 6: Laravel - Nguyễn Hữu Thể", để tải tài liệu gốc về máy hãy click vào nút Download ở trên

Tóm tắt nội dung tài liệu: Bài giảng Phát triển phần mềm nguồn mở - Bài 6: Laravel - Nguyễn Hữu Thể

Bài giảng Phát triển phần mềm nguồn mở - Bài 6: Laravel - Nguyễn Hữu Thể
LARAVEL
Nguyễn Hữu Thể
PHÁT TRIỂN PHẦN MỀM NGUỒN MỞ
Laravel
− A powerful MVC PHP framework
− Designed for developers who need a simple and 
elegant toolkit to create full-featured web 
applications. 
− Laravel was created by Taylor Otwell. 
2
Laravel
− Laravel is a MVC framework.
• Incorporates many of the best features of frameworks like 
CodeIgniter, Yii, ASP.NET MVC, Ruby on Rails, Sinatra, 
and others.
− Laravel is an Open Source framework. 
• It has a very rich set of features which will boost the speed
of Web Development. 
3
Laravel – Features
− Modularity
− Testability
− Routing
− Configuration management
− Query builder and ORM (Object Relational Mapper)
− Schema builder, migrations, and seeding
− Template engine
− E-mailing
− Authentication
− Redis
− Queues
− Event and command bus
4
Laravel – Version
5
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
Laravel – Installation
− Server Requirements
• PHP >= 5.6.4
• OpenSSL PHP Extension
• PDO PHP Extension
• Mbstring PHP Extension
• Tokenizer PHP Extension
• XML PHP Extension
6
Laravel - Installation
− Step 1 − Visit the following URL and download 
composer to install it on your system.
− https://getcomposer.org/download/
− Step 2 − After the Composer is installed, check the 
installation by typing the Composer command in the 
command prompt as shown in the following 
screenshot.
7
Laravel - Installation
− Step 3 − Move to path where you have created the 
new directory and type the following command there 
to install Laravel.
composer create-project --prefer-dist laravel/laravel MyProject
Successfully:
8
Laravel - Installation
− Step 4 − Open URL in the browser
Or
9
Configuration
− Public Directory
• Web server's document / web root to be the public directory. 
• The index.php in this directory serves as the front controller 
for all HTTP requests entering your application.
− Configuration Files
• All of the configuration files for the Laravel framework are 
stored in the config directory. 
− Directory Permissions
• Directories within the storage and the bootstrap/cache
directories should be writable by your web server or Laravel 
will not run. 
10
Configuration
− Application Key
• Set your application key to a random string. 
• If you installed Laravel via Composer or the Laravel 
installer, this key has already been set for you by the php 
artisan key: generate command.
• Typically, this string should be 32 characters long. 
• The key can be set in the .env environment file. 
• Renamed the .env.example file to .env
• If the application key is not set, your user sessions and other 
encrypted data will not be secure!
11
Configuration
− Additional Configuration
• Timezone and locale 
• Cache
• Database
• Session
− Configure your local environment: 
https://laravel.com/docs/5.3/configuration#environment-configuration
12
Application structure
− The default Laravel application structure is intended to 
provide a great starting point for both large and small 
applications. 
− You are free to organize your application however you like. 
− Laravel imposes almost no restrictions on where any given 
class is located - as long as Composer can autoload the 
class.
13
Root Directory
− app − the core code of the application.
− bootstrap − the application bootstrapping script.
− config − configuration files of application.
− database − your database migration and seeds.
− public − The application’s document root. It starts the 
Laravel application. JavaScript, CSS, Images,...
− resources − raw assets such as the LESS & Sass files, 
localization and language files.
− routes - all of the route definitions for your 
application. By default, three route files are included 
with Laravel: web.php, api.php, and console.php.
− storage − App storage, like file uploads... Framework 
storage (cache), and application-generated logs.
− test − various test cases.
− vendor − composer dependencies. 14
App Directory
− Console − All the artisan commands are 
stored in this directory.
− Exceptions − Contains your application's 
exception handler.
− Http − Contains your controllers, filters, 
and requests.
− Providers − Contains various service 
providers.
15

File đính kèm:

  • pdfbai_giang_phat_trien_phan_mem_nguon_mo_chuong_6_laravel_nguy.pdf