After writing versions of this guide in three different places, here's a more abstract version that should work for the 99% of Laravel apps out there.
Before getting started, here are some thing you'll need:
- PHP 7. 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.
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:
This process may take between half a minute 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.
If everything went right, you should now be watching the main page of your Laravel project. Congratulations, and enjoy the power of Laravel!