Favorit

Breaking News

Laravel Tutorial - Installation


Laravel - Every project has to start from somewhere, either assigned to you by your work or just an idea in your head. No matter where it originates, thoroughly planning out all the features before you start coding is paramount in completing a project.

How you plan is dependent on how your mind works. As a visual person, I like to plan on paper, drawing out the way I picture the screens looking and then working backward into how I would code it. Others prefer to write a project plan in a text file, wiki, or some mind mapping tool. It doesn’t matter how you plan, just that you do it.

For this guide, we are going to be building a link directory. Here is a list of fundamental goals for this links app:

Display a simple list of links.
Create a form where people can submit new links.
Validate the form.
Insert the data into the database.

The First Steps
With a simple plan of attack outlined, it’s time to get a brand new empty project up and running. I like to put all my projects in a ~/Sites directory, and these instructions will use that location. I’ve already “parked” this directory in Valet, so any folders will automatically be mapped to “foldername.test” in the browser.

Open your terminal application and switch into this directory.

mkdir ~/Sites
cd ~/Sites

Next, install Laravel’s command line installer:

composer global require "laravel/installer"
You need to make sure that the global Composer bin is in your path. You can do so by adding the following to your PATH in your ~/.bash_profile or ~/.zshrc if you are using Z shell:

export PATH="$HOME/.composer/vendor/bin:$PATH"
For the path to take effect, you need to restart your terminal session of source the file again:

source ~/.bash_profile
Now you can use the Laravel installer to create new projects from the command line:

laravel new links
This will create a new directory at ~/Sites/links and install an stock Laravel project. Visiting links.test in the browser now shows the default Laravel welcome page:


Now scaffold out the authentication system by running:

php artisan make:auth
Even though this tutorial will not dive into authentication by running this command, it will modify our views and routes. So by doing it early, we don’t have to worry about it messing with any of our code.

With the basics set up and working, it’s time to start doing some coding.

No comments