After writing this guide in three different documentation pages, I've decided to abstract it to an article I can keep updated. Keep in mind this are general instructions, and you may have to follow some custom steps depending on what you're trying to run. With that said, here's what you need to do:
Requirements
Before getting started, here are some thing you'll need:
- PHP7 - Learn how to install it in Windows, Mac or Linux
- Composer - Learn how to install it
- A terminal - Your OS should already come with one
Get the code into your computer
Let's assume the project is hosted on GitHub (or GitLab, any git service should work). The preferred method would be to perform a git clone. You can do this by running the following in your terminal of choice:
git clone https://github.com/someuser/someproject
Of course, not everyone has or wants to use git, so almost all git services offer a way to download zipped version of the repository. Just search for a "Download ZIP" option. Then, you'll want to unzip it before proceeding to the next step.
Installing dependencies
To light up the size of the repository, Laravel projects rarely bundle their dependencies with them. You'll need to use composer
to download them. To do this, just open a terminal window on the repository folder and run the following:
composer install
This process may take between one and five minutes depending on the number of dependencies.
Setting up the database
Most Laravel apps require a database. To keep it simple, we're gonna use a sqlite database, which is just a simple file and requires no external programs. To configure it, search for a .env.example
file on the repository and rename it to .env
. You'll also need to open the database
folder and create an empty file called database.sqlite
. After this, open your .env
file in a text editor and make the following changes:
-DB_DRIVER=mysql
-DB_DATABASE=homestead
+DB_DRIVER=sqlite
+DB_DATABASE=database/database.sqlite
Finally, open up a terminal window and run the following command:
php artisan migrate
Setting up the application key
Easy one! Just open up a terminal window, run the following and you're done!
php artisan key:generate
Get a server running
You can use almost any server to serve your app but, to keep it simple, we're gonna use Laravel's integrated one. Open up a terminal window and run the following command:
php artisan serve
You should now be able to access your app by using this link.
That's it!
If everything went right, you should now be watching the main page of your Laravel project. Congratulations and enjoy the power of Laravel!
Liked this article? Consider supporting my work.
Top comments (0)