Laravel is one of the beautiful php framework having all vital features to build web applications more efficiently. For Beginners who just has basic PHP knowledge only its just a nightmare to install laravel. Here is your simple guide for laravel install with easy & simple stpes to start your first laravel application.
Before installing Laravel here is your checklist to check all required setup you have.
- PHP 5.6 or higher version
- MySql (Latest Version)
Installing Laravel with Composer
PHP Composer is a famous tool to download & install PHP Packages. You can install Laravel too with PHP Composer.
composer global require "laravel/installer"
Make sure to place the
~/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $path so the laravel executable can be located by your system. Once you Installed Laravel you can create new Laravel application by this command.
laravel new blog
blog is application name. You can give whatever you like.
Laravel Install directly from Composer Command
Instead of installing laravel, we can create a new laravel application directly from PHP composer command
composer create-project --prefer-dist laravel/laravel blog
After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.
You can set all the database credientials in this .env (environment) file located in the main folder. If you have not renamed the .env.example file to .env, you should do that now.
The next thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the
php artisan key:generate command.
Typically, this string should be 32 characters long. The key can be set in the .env environment file. If the application key is not set, your user sessions and other encrypted data will not be secure!
Laravel needs almost no other configuration out of the box. You are free to get started developing! However, you may wish to review the config/app.php file and its documentation. It contains several options such as timezone and locale that you may wish to change according to your application.
You can see more configuration details in this official documentation