{"id":8406,"date":"2021-08-27T16:31:50","date_gmt":"2021-08-27T16:31:50","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=8406"},"modified":"2022-04-13T16:30:43","modified_gmt":"2022-04-13T16:30:43","slug":"what-is-composer-json-how-do-i-use-it","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/","title":{"rendered":"What is composer.JSON? How do I use it?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A file is generated from the composer tool. Which is the main file of the whole project which we call the composer file. The extension file is composer.json. It is the main composer.json that defines your project requirements.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vijaypk376\/c3954db13ebe043e8993e0bb49fcd63f.js\"><\/script>\n\n\n\n<h2 class=\"wp-block-heading\">How to setup a new or existing package<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can also say how to create a composer.json file in a Project to make it a package.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ussing composer init Command<\/li><li>Manually Creating composer.json file<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Ussing composer init Command<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">composer init &#8211; It is used to set up a new or existing package. The init command creates a basic composer.json file in the current directory.<br>Every project is a package.<br>As soon as you a composer.json in a directory, that directory is a package.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">composer.json<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Package name &#8211; in order to make that package installable you need to give it a name. It consists of vendor name and project name, separated by\/. The name can contain any character, including white spaces, names are case insensitive, the convention is all lowercase and dashes for word separation. It is required for published packages(libraries).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Syntax:- vendorname\/packagename<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ex:- devopsschool\/dev<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vijaypk376\/e3c8bb76a3f4323dd6100ca9e3e7096c.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description- <\/strong>A short description of the package. Usually, this is one line long. It is required for published packages(libraries).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Authors &#8211; <\/strong>The authors of the package. This is an array of objects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Each author object can have the following properties:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>name: The author&#8217;s name. Usually their real name.<\/li><li>email: The author&#8217;s email aaddress.<\/li><li>homepage: An URL to the author&#8217;s website.<\/li><li>role: The author&#8217;s role in the prject (e.g. developer or translator)<\/li><\/ul>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vijaypk376\/278c0cd63fbbdaf41226ff182438ddf9.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Minimum Stability &#8211;<\/strong> Composer accepts these flags as minimum-stability settings. The defualt setting for minimun-stability if not provided is assumed to be stable, but you sould define any of the flags down the hierarchy.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>stable (most stable)<\/li><li>re<\/li><li>beta<\/li><li>alpha<\/li><li>dev (least stable)<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Package Type &#8211;<\/strong> Package types are used for custom installation logic. If you have a package that needs some special logic, you can define a custom type. It default to library.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Library<\/li><li>Project<\/li><li>Metaapackage<\/li><li>Composer-plugin<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">License &#8211; The license of the package. This can be either a string or an array of strings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ex:- MIT<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vijaypk376\/a41cdb2e13a9d3b69db4625491a997d6.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A file is generated from the composer tool. Which is the main file of the whole project which we call [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5049],"tags":[333,5534,5052,2339,311],"class_list":["post-8406","post","type-post","status-publish","format-standard","hentry","category-laravel","tag-command","tag-composer","tag-laravel","tag-project","tag-tools"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is composer.JSON? How do I use it? - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is composer.JSON? How do I use it? - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"A file is generated from the composer tool. Which is the main file of the whole project which we call [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-27T16:31:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T16:30:43+00:00\" \/>\n<meta name=\"author\" content=\"rajeshkumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rajeshkumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"What is composer.JSON? How do I use it?\",\"datePublished\":\"2021-08-27T16:31:50+00:00\",\"dateModified\":\"2022-04-13T16:30:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/\"},\"wordCount\":379,\"commentCount\":0,\"keywords\":[\"command\",\"composer\",\"laravel\",\"project\",\"Tools\"],\"articleSection\":[\"Laravel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/\",\"name\":\"What is composer.JSON? How do I use it? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-08-27T16:31:50+00:00\",\"dateModified\":\"2022-04-13T16:30:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-composer-json-how-do-i-use-it\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is composer.JSON? How do I use it?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\",\"name\":\"rajeshkumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"caption\":\"rajeshkumar\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/rajeshkumar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is composer.JSON? How do I use it? - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/","og_locale":"en_US","og_type":"article","og_title":"What is composer.JSON? How do I use it? - scmGalaxy","og_description":"A file is generated from the composer tool. Which is the main file of the whole project which we call [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/","og_site_name":"scmGalaxy","article_published_time":"2021-08-27T16:31:50+00:00","article_modified_time":"2022-04-13T16:30:43+00:00","author":"rajeshkumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rajeshkumar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"What is composer.JSON? How do I use it?","datePublished":"2021-08-27T16:31:50+00:00","dateModified":"2022-04-13T16:30:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/"},"wordCount":379,"commentCount":0,"keywords":["command","composer","laravel","project","Tools"],"articleSection":["Laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/","name":"What is composer.JSON? How do I use it? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-08-27T16:31:50+00:00","dateModified":"2022-04-13T16:30:43+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-composer-json-how-do-i-use-it\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"What is composer.JSON? How do I use it?"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361","name":"rajeshkumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","caption":"rajeshkumar"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/rajeshkumar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/8406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=8406"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/8406\/revisions"}],"predecessor-version":[{"id":8428,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/8406\/revisions\/8428"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=8406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=8406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=8406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}