Home >Backend Development >PHP Tutorial >Using GitHub to host the Larval framework

Using GitHub to host the Larval framework

WBOY
WBOYOriginal
2016-08-08 09:27:481996browse

Every new framework has its own installation method. There are several installation methods for laravel:


(1) Install by downloading the Laravel package
(1) Install Composer
(2) Download the latest Larvel framework https://github.com/laravel/laravel/archive/master.zip
(3) Install git
(4) Unzip the downloaded Laraval to a directory, enter the directory and use git to execute: composer install ) to install all framework dependency packages
  (5) Update the Laravel framework, use composer update to update

(2) Install through ComPoser
(1) Install ComPoser
(2) Execute command: composer create-project laravel/laravel --prefer-dist

(3) Install through Laravel installer
(1) First, download the Laravel installer through Composer, composer global require "laravel/installer=~1.1"

(2) Modify the environment variables:
~/.composer/vendor/bin path added Go to the PATH environment variable
(3) After successful installation, you can use the command laravel new to create a new installation of Laravel in the directory you specify.
For example, laravel new blog will create a directory called blog in the current directory, which stores the newly installed
Laravel and its dependent tool packages. This installation method is much faster than installing through Composer.

(4) Install ComPoser Official method: https://getcomposer.org/download/
http://docs.phpcomposer.com/00-intro.md
(1) Use php to install
Because I I am using xampp, so first use the dos command in cmd to enter C:xamppphp and then use
C:xamppphp>php -r "readfile('https://getcomposer.org/installer');" | php
Run the following The code creates a batch file and puts it in the environment variable
C:bin>echo @php "%~dp0composer.phar" %*>composer.bat
Close the DOS window and reopen it. Running the following code normally means the installation is successful. (There is no problem with the crab test)
C:Usersusername>composer -V
Composer version 27d8904
(2) Use the client to install: composer https://getcomposer.org/Composer-Setup.exe
(3) linux Install under the system
aDownload composer.phar
curl -sS https://getcomposer.org/installer | php
b. Move composer.phar to the environment to make it executable
mv composer.phar /usr/local/bin/composer
c. Test (the crab installation process is normal)
[root@************** ~]# composer -V

(5) gitLub hosting service
1. Register an account and create a warehouse
The first step to use github is of course to register a github account. After that, you can create a warehouse (free users can only build public warehouses), Create a New Repository,
fill in the name and create, and then some warehouse configuration information will appear. This is also a simple tutorial on git.
2. Install the client msysgit
github is the server. If you want to use git on your own computer, we also need a git client. I choose msysgit here. This only provides the core functions of git and is based on the command line. of.
If you want a graphical interface, just install TortoiseGit based on msysgit.
After installing msysgit, right-click the mouse and some more options will appear. Right-click in the local warehouse and select Git Init Here. An additional .git folder will appear, which means that the local git is created successfully.
Right-click Git Bash to enter the git command line. In order to transfer the local warehouse to github, you also need to configure the ssh key.
3. Configure Git
First create the ssh key locally;
$ ssh-keygen -t rsa -C "your_email@youremail.com"
Change the following your_email@youremail.com to your email address, Afterwards, you will be asked to confirm the path and enter a password. We just use the default one and press Enter. If successful, the .ssh folder will be generated under ~/,
go in, open id_rsa.pub, and copy the key inside.
Return to github, enter Account Settings, select SSH Keys on the left, Add SSH Key, fill in the title as you like, and paste the key. In order to verify whether it is successful, enter under git bash:
$ ssh -T git@github.com
If it is the first time, you will be prompted whether to continue. If you enter yes, you will see: You've successfully authenticated, but GitHub does not provide shell access. This means that you have successfully connected to github.
The next thing we have to do is upload the local warehouse to github. Before that, we also need to set the username and email, because github will record them every time they commit.
$ git config --global user.name "your name"
$ git config --global user.email "your_email@youremail.com"
Enter the warehouse to be uploaded, right-click git bash, add the remote address:
$ git remote add origin git@github.com:yourName/yourRepo.git
The following yourName and yourRepo represent your github username and the newly created warehouse. After adding, enter .git and open config. There will be an extra remote "origin" here. Content, this is the remote address just added,
You can also directly modify the config to configure the remote address.
4. Submit and upload
Next add some files to the local warehouse, such as README,
$ git add README
$ git commit -m "first commit"
Upload to github:
$ git push origin master
git push command The local repository will be pushed to the remote server.
The git pull command is the opposite.
After modifying the code, use git status to view the differences in the files, use git add to add files to be committed, or use git add -i to intelligently add files. Then git commit submits this modification, and git push uploads it to github.
5.gitignore file
.gitignore, as the name suggests, tells git which files need to be ignored. This is a very important and practical file. Generally, after we finish writing the code, we will perform operations such as compilation and debugging. During this period, many intermediate files and executable files will be generated.
These are not code files and do not need to be managed by git. We will see many such files in git status. If we use git add -A to add them, they will be added. However, it is too troublesome to add them one by one manually.
At this time we need .gitignore. For example, for general C# projects, my .gitignore is written like this:
bin
*.suo
obj
bin and obj are the compilation directories, and they are not source codes, so ignore them; the suo file is the configuration file of vs2010, which is not needed. In this way, you will only see the source code files in git status, and you can safely git add -A.
6.tag
We can create a tag to point to a critical period in software development. For example, when the version number is updated, we can create a tag such as "v2.0" or "v3.1" so that we can review it in the future. It will be more convenient.
The use of tag is very simple. The main operations are: view tag, create tag, verify tag and share tag.
6.1 View tag
List all tags:
git tag
The tags listed in this way are sorted alphabetically, regardless of the creation time. If you only want to view certain tags, you can add restrictions:
git tag -l v1.*
This will only list versions 1.
6.2 Create tag
Create lightweight tag:
git tag v1.0
The tag created in this way does not come with other information, corresponding to the tag with information:
git tag -a v1.0 -m 'first version '
-m is followed by annotation information, which will be very useful when viewing it in the future. This is a normal tag, and there is also a signed tag:
git tag -s v1.0 -m 'first version'
The premise is that you have a GPG private key, just replace the a above with s. In addition to adding tags to the current progress, we can also add tags to previous commits:
#First check the previous commit
git log --oneline
#If there is such a commit: 8a5cbc2 updated readme
#Add a tag to it like this
git tag -a v1.1 8a5cbc2
6.3Deleting tag
is very simple, after knowing the tag name:
git tag -d v1.0
6.4Verify tag
If you have the GPG private key, you can verify the tag:
git tag -v v1.0
6.5 shared tag
When we execute git push, the tag will not be uploaded to the server. For example, in the current github, after creating the tag, git push will not see the tag on the github web page. In order To share these tags, you must do this:
git push origin --tags

The above introduces the use of GitHub to host the Larval framework, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn