How to Install Laravel 10 using Composer

How to Install Laravel 10 using Composer

In this blog, we will learn about How to Install Laravel 10 using Composer.

Laravel is a web application framework with expressive, elegant syntax. Laravel is used for creating web-based applications following the model-view-controller (MVC) architectural pattern and is based on Symfony. Laravel provides a better development experience while providing dependency injection, database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.

Let’s learn How to Install Laravel 10 using Composer

Steps to Install Laravel 10 using Composer:

Step 1: Prerequisites

  • Php version – 8 
  • Composer version – 2

Composer to install all required libraries to run Laravel.

You can install Composer from the link given below

https://getcomposer.org/ 

After installation of the composer, run the below command on your terminal.

Composer

It gives output like this.

Composer command

Step 2: After Successfully installing PHP and Composer, you need to create a new Laravel project via Composer. Run the below command.

composer create-project laravel/laravel blog-app

It gives output like this.

Create project using composer

Step 3: After successfully creating the project, start Laravel’s local development server using Laravel’s Artisan CLI serve command

cd blog-app
php artisan serve

It gives output like this.

local development server

Now copy this link and paste it into your browser. It will look like this.

browser

Conclusion:

Using the above steps, you can swimmingly install Laravel 10 using Composer. Alternatively, you can also install ReactJS using Laravel. If you cannot install Laravel 10, let me know through the comment box.

Moreover, share the tutorial with your Laravel friends and stay updated with us so that you do not miss out on important solutions.

Happy Coding!

Previous Article

What is Content Seeding? How to Use it to Drive More Traffic

Next Article

How to Add or Change Favicon on Shopify

View Comments (9)
  1. Note that php version at least 8.1 is required.
    I had php 8.0.13 in my path, and got laravel 9.
    Would be useful to know how to require laravel of exact version when creating project.

  2. It installs Laravel 9.0 and if I use composer create-project laravel/laravel:^10.0 example-app y return error ” Could not find package laravel/laravel with version 10″

  3. Got this error after
    php artisan serve

    PHP Warning: require(C:\xampp\htdocs\trav_lesson/vendor/autoload.php): Failed to open stream: No
    such file or directory in C:\xampp\htdocs\trav_lesson\artisan on line 18
    PHP Fatal error: Uncaught Error: Failed opening
    required ‘C:\xampp\htdocs\trav_lesson/vendor/autoload.php’ (include_path=’.;C:\php\pear’) in C:\xampp\htdocs\trav_lesson\artisan:18
    Stack trace:
    #0 {main}
    thrown in C:\xampp\htdocs\trav_lesson\artisan on line 18

  4. Maruf Abdullah

    Now Laravel 11 introduced. So if you try to use the command “composer create-project laravel/laravel projectname-app”, you will get the latest version of Laravel. Sometimes we are new to the laravel and learning Laravel by watching any tutorial and it’s recorded in Laravel 10. We might want to use the same version. In that case, we can run this command to install the Laravel 10 “composer create-project laravel/laravel:10.0^ projectname-app”. So we will get the Laravel 10 install on our device instead of the latest version.

    1. Thank you for your insightful comment! Yes, you’re absolutely right. Laravel 11 has been introduced, and by default, the command composer create-project laravel/laravel projectname-app will install the latest version. For those following tutorials or working with Laravel 10, specifying the version using composer create-project laravel/laravel:10.0^ projectname-app is a great way to ensure you’re using the same version.

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨