+1 vote
in Laravel by
Define Composer.

2 Answers

0 votes
by

Composer is the package manager for the framework. It helps in adding new packages from the huge community into your laravel application.

For example, one of the most used packages for authentication will be Passport, for including that into your project, you can run the below command on your terminal:

composer requires laravel/passport

It generates a file(composer.json) in your project directory to keep track of all your packages. A default composer.json file of your laravel project will look something like below:

{

    "name": "laravel/laravel",

    "type": "project",

    "description": "The Laravel Framework.",

    "keywords": [

        "framework",

        "laravel"

    ],

    "license": "MIT",

    "require": {

        "php": "^7.3|^8.0",

        "fideloper/proxy": "^4.4",

        "fruitcake/laravel-cors": "^2.0",

        "guzzlehttp/guzzle": "^7.0.1",

        "laravel/framework": "^8.12",

        "laravel/tinker": "^2.5"

    },

    "require-dev": {

        "facade/ignition": "^2.5",

        "fakerphp/faker": "^1.9.1",

        "laravel/sail": "^1.0.1",

        "mockery/mockery": "^1.4.2",

        "nunomaduro/collision": "^5.0",

        "phpunit/phpunit": "^9.3.3"

    }

}

The “require” and “require-dev” keys in composer.json specify production and dev packages and their version constraints respectively.

0 votes
by

It is an application-level package manager for PHP. It provides a standard format for managing PHP software dependencies and libraries.

...