Difference between require-dev and require in PHP? Last Updated : 05 Nov, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report Before going to understand the difference between require and require_dev first understand what is require and require_dev. require: These are must packages for the code to run. It defines the actual dependency as well as package version. require_dev: It defines the packages necessary for developing the project and not needed in production environment. Note: The require and require_dev are important parameters available in composer.json. What is composer? Composer is dependency/parameter manager in php. It can be used to install keep a track of and update project dependency. Composer also takes care of autoload of dependencies that application relies on letting easily use the dependency inside the project without worrying about including them at the top of any given file. Dependency for project are listed within a "composer.json" file which typically located in the project root. This file holds the information about required version of packages for production and development. This file can be edited manually using any text editor or automatically through the command line via command such as "composer require " or "composer require_dev . To start using composer in the project first need to create composer.json file. It can be either created manually or simply run composer init. After run composer init in the terminal it will ask some basic information about the project such as package name, description (it is optional), Author and source other information like minimum stability, license and required package. The require key in the composer.json specifies composers which packages the project depends on require takes an object that maps package names Example: javascript { "require": { // name of package. "composer/composer:" "1.2.*" } } In the above example "composer/composer" specifies vendor name and project name separated by slash ('/') and "1.2.*" specifies the version name. To install the dependency need to run the composer install command and then it will find the defined package that method for supplied version constraints and download it into vendor directory. It convention to put third party code into directory named vendor. The installed command also created a composer.lock file. Difference Between require and require_dev: require: It define actual dependency as well as package version. The require lists the package require by this package. The package will not be installed unless those requirements can be met. require_dev: It define the packages necessary for developing project. The require_dev lists packages required for developing this package, or running tests, etc. The dev requirements of the root package are installed by default. Both install or update support the "--no-dev" option that prevents dev dependencies from being installed. Comment More infoAdvertise with us Next Article Difference between $var and $$var in PHP S Samdare B Follow Improve Article Tags : Web Technologies PHP PHP-packages Similar Reads Difference between require() and require_once() in PHP PHP require() Function: The require() function in PHP is mostly used to include the code/data of one PHP file to another file. During this process, if there are any kind of errors then this require() function will display a warning along with a fatal error which will immediately stop the execution o 2 min read Difference between require() and include() in PHP In this article, we will see the require() and include() Functions in PHP, along with understanding their basic implementation through the illustration. Both require() and include() Functions are utilized to add the external PHP files in the current PHP script. With this, both functions enhance the 3 min read Difference between $var and $$var in PHP In PHP, $var is used to store the value of the variable like Integer, String, boolean, character. $var is a variable and $$var stores the value of the variable inside it. $var: Syntax: $variable = value;The $variable is the variable nameThe value is the initial value of the variable. Example 1: This 2 min read The Difference Between require() and library() in R R Programming Language has a lot of packages with different functions which can be used for data analysis. To make use of the functions, we have to install the packages to which the functions belong. Difference Between require() and library() in Rrequire() library() Only gives a warning if the packa 4 min read Difference Between --save and --save-dev in NodeJS In NodeJS, when you install packages using npm (Node Package Manager), you often need to decide whether to install them as a dependency or devDependency. This is where the flags --save and --save-dev come into play. These flags control where the installed packages are placed in the package.json file 5 min read What's the difference between and in PHP ? There are many types of line-ending characters that are used in PHP. They differ depending upon the operating system and editors using them. It's also based on how apps, libraries, protocols, and file formats deal with things. These characters are invisible. \n is used for the newline or linefeed, w 2 min read Like