未加星标

Getting Started With Laravel

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二03 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

Laravel is one of the most popular, if not THE most popularphp framework and after using Laravel and comparing it with the likes of Zend and Symfony it's easy to see why, over the courses of multiple tutorials we're going to go over some of the best features of Laravel.


Getting Started With Laravel

Laravel has so many features and helpful classes that you can quickly and easily build any application or API with Laravel.

Installing Laravel

There are multiple ways you can install Laravel, the easiest way you can install Laravel is by usingcomposer.

composer global require "laravel/installer"

Once Laravel is installed it will have a command of laravel new which you can use to create your new project.

laravel new created-new-project

This will add a fresh Laravel installation into the directory you're in.

Directory Structure

Once Laravel is installed it will create the structure of the application.

App Bootstrap Config Database Public Resources Routes Storage Tests Vendor App

The app folder is used to home the classes for your application such as commandline class or controller classes.

Laravel comes pre-installed with controllers you can use in almost all of your applications such as the Authentication controllers to manage login, reset password and register forms.

Bootstrap

Bootstrap folder is used to house objects such as instantiating the Laravel application and defining the autoload functionality.

Config

Config folder is used to house the settings for your application. Some of these application settings can be overridden from the environment settings you define in the root of the application.

Database

The database folder is used to store the factories, migration and seed files for your application.

Public

The public folder is where you documentroot should be pointing to. This is the folder that holds your index.php and is what will be loaded when visitors navigate to your application. This folder is where you will store all your compiled CSS and JS files used in the application.

Resources

Laravel development uses the MVC development method and will store the view of the MVC inside the resources folder.

Laravel also chooses Sass and VueJS for your frontend development, you should use the resources folder to store the un-compiled Sass and VueJS files.

Routes

This is a new folder in Laravel 5.3, before this will sit in the app/http folder, it is here that you will include all the routes for your application. This is split up into API routes, Console routes and Web routes allowing you to better organise the routes.

Storage

The storage folder is used for any files you need to store in the application such as user uploaded files. This is also where you will store cache and log files for your application.

You need to make sure that the storage folder is writable by your web server or Laravel will not work correctly.

Tests

As the name suggests you will store your applications unit tests in this folder.

View this to learn more about test driven development .

Vendor

The vendor folder is where your third party dependencies will be stored after they have been imported using Composer.

Application Key

To setup your Laravel application you need to generate a unique application, this key is used as the salt for your users sessions and other encrypted data.

To generate an application key you can use the Artisan command

php artisan key:generate Homestead

Laravel comes with a local environment setup called Homestead which is a simple Vagrant virtual machine providing you with the perfect setup for your Laravel applications.

First you need to make sure that Vagrant is setup on your machine, so you will need to install VirtualBox and Vagrant .

Homestead is a pre-built Vagrant box which can be easily installed by

vagrant box add laravel/homestead

Then you can install the Homestead installation files by cloning the repository.

git clone https://github.com/laravel/homestead.git Homestead

Once the repository is cloned run the command

bash init.sh

Will create the Homestead configuration file where you can edit the settings of your virtual machine.

Homestead

Back to top

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

主题: LaravelBootstrapCSSPHP
分页:12
转载请注明
本文标题:Getting Started With Laravel
本站链接:http://www.codesec.net/view/481734.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(22)