Portal: Goofyy Technology Residence
laravel-simple, elegant PHP development Framework (PHP WEB framework)
PHP is an excellent language, when PHP meets the Laravel framework, simply, Laravel framework is the highest framework of the PHP framework, the small part of summer leisure to play a game. Not much, the first is the installation of the Laravel framework, many of the novice died in this step.
First, write a small compilation of the development environment:
Installation Environment:
Operating system: Mac OS X10.10.4
Database: MySQL 5.5.16
php:5.5.24
Laravel5.1 is used in small series. PHP version requirements are >=5.5.9 Mysql 5.1+
OpenSSL PHP Extensions-PDO PHP extensions-mbstring PHP extensions-tokenizer PHP extensions
Installing Laravel
There are three ways to install the laravel.
Composer installation
Composer is a tool used in PHP to manage dependency (dependency) relationships. You can declare your dependencies on the External tool Library (libraries) in your project, and composer will help you install these dependent library files.
Execute under the path to be installed:
Composer Create-project Laravel/laravel Learnlaravel5
Terminal execution, the composer manager downloads the appropriate dependencies and libraries. The current path produces a Learnlaravel5 folder. After downloading, to give sufficient permissions to the appropriate directory, the Web server needs to have write access to all directories and Bootstrap/cache directories under the storage directory. If you are using a Homestead virtual machine, these permissions have been set up for you.
The following is the configuration of the Web site's root directory as Learnlaravel5/public
Specify 8000 ports on localhost to point to the public directory. Turn on the server. Successful execution will prompt
Goofy-2:blog goofygao$ php-s localhost:8000-t publicphp 5.5.24 Development Server started at Thu Jul 16:58:16 2015Lis tening on http://localhost:8000Document root is/users/goofygao/laravel/blog/publicpress ctrl-c to quit.
The Artisan tool in the same root directory can also be opened for service. root directory execution
PHP Artisan serve also open the service
Then access the http://localhost:8000 configuration in the browser at this time to access the
Through the Laravel installer
Download Laravel Installer via composer installer
Composer global require "laravel/installer=~1.1"
Make sure that the ~/.composer/vendor/bin is in the system path path so that the Laravel command can be executed correctly. Once the installation is complete, you can create a new Laravel installation in the current directory by simply executing the laravel new command:
Laravel New Blog
A lot of small partners died in this step because everyone knows why. So you can turn it over.
After execution completes, a blog directory is generated. The installation was successful. Also pay attention to the permissions, the other ibid.
SOURCE Installation
First of all, from GitHub or Laraverl official website download Laravel source package, after decompression, installation.
Download Address: http://www.golaravel.com/download/
Let's take a look at the extracted file Composer.json. This file is primarily composer to download laravel dependencies and configuration information.
If you want to add the corresponding configuration information, you can go to https://packagist.org/this site download configuration.
For example, you want to add configuration information for mail messages. You only need to search mail. Select the corresponding version. Add configuration information to Composer.json
Require Nette/mail
Add it in Composer.json.
Then execute it in the root directory
PHP Composer.phar Install
Or
Composer Install
If you want to update, execute the following command
PHP Composer.phar Update
Once the installation is complete, you can access it as configured above.
Here are some simple configurations to do. Change the key configuration.
The next thing you need to do after installing Laravel is to set up a random string as your app's secret key (key). If you are installing the Laravel through the Composer or Laravel installer, this key has been automatically generated and set by the Key:generate command. In general, the length of the string as key is 32 characters. This key can also be set in the. env environment configuration file. If you have not renamed the. env file, then do it now. Env.example If the app's key is not configured, the session and other data that needs to be encrypted will not be secure!
Terminal execution:
PHP Artisan Key:generate
Generate key.
The following is the configuration of the database. The root directory/config/database.php. Small compilation database is MySQL. So the configuration is as follows
' MySQL ' = [ ' driver ' = ' mysql ', ' host ' = ' env ' (' db_host ', ' localhost '), ' database ' = = env (' db_database ', ' laravel '), ' username ' = env (' Db_username ', ' root '), ' password ' + env (' Db_password ', ' secret '), ' charset ' = ' utf8 ', ' collation ' = ' utf8_unicode_ci ', ' prefix ' = ', ' strict ' and ' = False, ],
This looks like the basic configuration is complete. Now it's breaking ground.
Off-topic: small part of the middle is not saved, is also good drunk. In the next few days seriously toss laravel frame. Come on. The blog will keep up.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.