Laravel 5.7 Tutorial
Receive new Laravel tutorials.
Receive new PHP tutorials.
Laravel is a popular PHP framework, first created in 2011 and always growing in popularity. In 2015 Laravel was the most starred PHP framework on Github. Since its first days, it has experienced an exponential adoption among PHP developers.
Laravel has a lot of modern features just like the well known Python framework Django. It's also based on Symfony, one of the greatest PHP framework and is considered by many developers as a lightweight version of Symfony.
In this tutorial, we are going to focus on the latest version of Laravel which is 5.7
Throughout this tutorial series, we are going to build a PHP web application to demonstrate many features and constructs of Laravel 5.7, from templates and routes to models and database.
For an updated and complete version of this tutorial, check out Laravel 5.7 Tutorial: Build your First CRUD App with Laravel and MySQL (PHP 7.1)
First things first. We are going to start by installing PHP and Laravel 5.7 on our system.
This tutorials has these requirements:
- A PHP environment installation,
- MySQL database system installed.
So you need to have PHP installed on your system. To check if PHP is installed, open your terminal on Linux/MAC or command prompt on Windows and type:
You should get something like this
PHP 7.0.6-1+donate.sury.org~wily+1 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
Which means you have PHP 7 installed.
If the command is not recognizable by your system then go ahead and install PHP before continuing with this tutorial.
Now lets install Composer. In case you are wondering, this is a package/dependency manager for PHP that allows you too pull and automatically install PHP packages (frameworks, libraries etc.) from a remote registry where other PHP developers publish their packages for everybody to install. For example, Laravel 5.7 can be installed using Composer.
To install Composer ,visit this website then copy
the installer script and paste it in your terminal. The installer will download the latest composer.phar
to your current directory.
To run Composer, type:
From the same directory where you have downloaded the installer script.
You can also make Composer available globally by putting it in a folder that's part of the PATH system variable
On Unix based systems such as Linux and MAC you can do something like that:
sudo mv composer.phar /usr/local/bin/composer
Or without sudo on some systems, by the way I'm using an Ubuntu system so the commands I enter maybe different on your system.
Now you can run:
To use Composer from your terminal.
Downloading and installing Laravel 5.7
Using Composer you can install larave 5.7 with just one command:
composer global require "laravel/installer"
Next add $HOME/.config/composer/vendor/bin to your PATH system variable to make laravel available from any directory.
It can be also
$HOME/.composer/vendor/bindepending on your system.
Now you can type laravel on your terminal to see a list of available commands at your disposal
Creating a new Laravel 5.7 project
To create a new Laravel 5.7 project, just type:
laravel new MyApp
You can also use Composer to create a Laravel project without using the laravel utility:
composer create-project --prefer-dist laravel/laravel MyApp
Now you can run your local server with:
cd MyApp php artisan serve
You should be able to visit your web app at http://localhost:8000
You can find more instructions about installation on Laravel 5.7 docs
For the complete tutorial, check out Laravel 5.7 Tutorial: Build your First CRUD App with Laravel and MySQL (PHP 7.1)
So we have created our fresh Laravel 5.4 project .See you on the next part where we are going to dive into creating database Models for our project .
Note: We also publish our tutorials on Medium and DEV.to. If you prefer reading in these platforms, you can follow us there to get our newest articles.
You can reach the author via Twitter:Follow @ahmedbouchefra
About the author
Read our other tutorials
- Angular Tutorial
- Laravel 6 Tutorial
- React Tutorial
- React Hooks Tutorial
- React Native Tutorial
- Webpack Tutorial
- PHP Tutorial
- Django Tutorial
- Java Spring Tutorial
- Rails 6 Tutorial
- Ionic 4 Tutorial
- TypeScript Tutorial
- Bootstrap 4 Tutorial
- Electron Tutorial
- Cordova Tutorial
- HTML Tutorial
- GraphQL Tutorial
- CSS Grid Layout Tutorial
- PWA Tutorial