{"id":41634,"date":"2022-10-05T12:30:32","date_gmt":"2022-10-05T17:30:32","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=41634"},"modified":"2022-12-28T05:13:01","modified_gmt":"2022-12-28T11:13:01","slug":"how-to-install-and-use-composer-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/","title":{"rendered":"How to Install and Use Composer on Ubuntu 20.04"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p><img decoding=\"async\" class=\"alignnone size-full wp-image-43145\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp\" alt=\"how to install and use composer on ubuntu 22.04\" width=\"742\" height=\"372\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04-300x150.webp 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04-150x75.webp 150w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>Composer is a dependency management tool in PHP; unlike \u2018apt\u2019 and \u2018yum\u2019, it\u2019s not a package manager. Because it handles the dependencies for PHP projects, per project basis, you can declare, manage and install dependencies with Composer on any PHP project running PHP version 7.2.5 or above.<\/p>\n<p>It\u2019s used in Magento to manage its components and dependencies. The composer uses a composer.json file which specifies version and dependency information. In this tutorial, you are going to install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.<\/p>\n<p><!--more--><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69cd0281b80c6\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69cd0281b80c6\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#Download-and-Install-Composer\" >Download and Install Composer<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#Using-Composer-in-a-PHP-project\" >Using Composer in a PHP project<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>A server with Ubuntu 20.04 as OS<\/li>\n<li>User privileges: root or non-root user with sudo privileges<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Before you start, make sure to update apt-cache with:<\/p>\n<pre>$ sudo apt-get update<\/pre>\n<p>Now, go ahead and install PHP. If you don\u2019t already have it installed with the command:<\/p>\n<pre> $ sudo apt install php7.4<\/pre>\n<p>Now you can install php-cli and unzip also.<\/p>\n<pre> $ sudo apt install php-cli unzip<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Download-and-Install-Composer\"><\/span>Download and Install Composer<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Composer is installed with a composer-setup.php script, which we will first download in \/tmp, verify it and then run the script to install Composer.<\/p>\n<p>First, run the command to download the script in \/tmp\/composer-setup.php:<\/p>\n<pre> $ curl -sS https:\/\/getcomposer.org\/installer -o \/tmp\/composer-setup.php<\/pre>\n<p>Next, we will obtain the Composer signature and save it in the HASH system variable with:<\/p>\n<pre> HASH=`curl -sS https:\/\/composer.github.io\/installer.sig`<\/pre>\n<p>Now, to verify if the installation script is safe to run, execute the following code:<\/p>\n<pre> $ php -r \"if (hash_file('SHA384', '\/tmp\/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;\"<\/pre>\n<p>If you get this output, the installation is safe to run.<br \/>\nInstaller verified<br \/>\nYou can now execute the installation script that we previously downloaded in \/tmp\/composer-setup.php to install composer system-wide in the \/usr\/local\/bin directory with the command:<\/p>\n<pre> $ sudo php \/tmp\/composer-setup.php --install-dir=\/usr\/local\/bin --filename=composer<\/pre>\n<p>To check if the installation went through successfully, simply run:<\/p>\n<pre> $ composer<\/pre>\n<p>You should receive similar output to this:<\/p>\n<pre>   ______\r\n  \/ ____\/___  ____ ___  ____  ____  ________  _____\r\n \/ \/   \/ __ \\\/ __ `__ \\\/ __ \\\/ __ \\\/ ___\/ _ \\\/ ___\/\r\n\/ \/___\/ \/_\/ \/ \/ \/ \/ \/ \/ \/_\/ \/ \/_\/ (__  )  __\/ \/\r\n\\____\/\\____\/_\/ \/_\/ \/_\/ .___\/\\____\/____\/\\___\/_\/\r\n                    \/_\/\r\nComposer version 2.3.5 2022-04-13 16:43:00\r\n \r\nUsage:\r\n  command [options] [arguments]\r\n \r\nOptions:\r\n  -h, --help                     Display help for the given command\u2026\r\n\u2026.<\/pre>\n<p>Composer can also be installed locally to the project\u2019s directory or in the home directory of the user. For example, if you want to install Composer in the home directory of the user dev, you will need to navigate to his directory and run the following command as the user dev<\/p>\n<pre> $ curl -sS https:\/\/getcomposer.org\/installer | php<\/pre>\n<p>Now you can run composer with the command:<\/p>\n<pre>$ php composer.phar<\/pre>\n<p>And you will receive similar output as previously.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Using-Composer-in-a-PHP-project\"><\/span>Using Composer in a PHP project<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now to use Composer in a PHP project, you will create a directory for your project and add the PHP dependencies using composer. For this tutorial, we will use the <a href=\"https:\/\/packagist.org\/packages\/monolog\/monolog\">Monolog <\/a> package for sending logs to files, sockets, databases, and various web services.<\/p>\n<p>Now to create the directory monolog and add the Monolog package, use the following commands:<\/p>\n<pre> $ mkdir monolog<\/pre>\n<pre>$ cd monolog<\/pre>\n<pre>$ composer require monolog\/monolog<\/pre>\n<p>Now you can list your directory, and you will see that there is a composer.json file in your directory, which has the monolog package as a dependency.<\/p>\n<pre> $ cat composer.json\r\n{\r\n    \"require\": {\r\n        \"monolog\/monolog\": \"^2.6\"\r\n    }\r\n}<\/pre>\n<p>Now you can add the following PHP code in the <b>monolog.php<\/b> file to test the functionality of the monolog.<\/p>\n<p><!--?php require __DIR__ . '\/vendor\/autoload.php'; use Monolog\\Logger; use Monolog\\Handler\\StreamHandler; $logger = new Logger('my_logger'); $logger-&gt;pushHandler(new StreamHandler('php:\/\/stderr', Logger::DEBUG)); $logger-&gt;info('Message in the terminal'); &lt;\/pre&gt; &lt;p&gt;You will notice the \/vendor\/autoload.php which loads the dependency and uses it. Now you can run the php script with:&lt;\/p&gt; &lt;pre&gt; $ php monolog.php &lt;\/pre&gt; &lt;p&gt;This should output a sample log message, which looks something like this &lt;b&gt;[2022-06-01T09:38:35.535205+00:00] my_logger.INFO: Message in the terminal [] [] &lt;\/b&gt; &lt;\/p&gt; &lt;h2&gt; Updating PHP dependencies&lt;\/h2&gt; &lt;p&gt; You can update the dependencies in the composer.json file with the following command:&lt;\/p&gt; &lt;pre&gt; $ composer update &lt;\/pre&gt; &lt;p&gt;This will check for newer versions of the dependencies in your and install them if they are within the constraints defined in the composer.json file. If the newer versions are installed this will update the composer.json file along with the composer.lock file.&lt;br ?--> To update only a specific package in your PHP project, you can use the command:<\/p>\n<pre> $ composer update vendor\/package<\/pre>\n<p>Congratulations! You successfully installed Composer on Ubuntu 20.04 and added package dependency in the composer.json file. If you find it difficult to install Composer, you can always contact our technical support, and they will do the rest for you. We are available 24\/7.<\/p>\n<p>If you liked this post on how to install and use <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting\/\">Composer on Ubuntu 20.04<\/a>, please share it with your friends on social networks or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Composer is a dependency management tool in PHP; unlike \u2018apt\u2019 and \u2018yum\u2019, it\u2019s not a package manager. Because it handles &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Install and Use Composer on Ubuntu 20.04\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#more-41634\" aria-label=\"Read more about How to Install and Use Composer on Ubuntu 20.04\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":43145,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1698],"tags":[],"class_list":["post-41634","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-ubuntu","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Install and Use Composer on Ubuntu 20.04 | RoseHosting<\/title>\n<meta name=\"description\" content=\"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.\" \/>\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.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install and Use Composer on Ubuntu 20.04\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-05T17:30:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-28T11:13:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Install and Use Composer on Ubuntu 20.04\" \/>\n<meta name=\"twitter:description\" content=\"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Install and Use Composer on Ubuntu 20.04\",\"datePublished\":\"2022-10-05T17:30:32+00:00\",\"dateModified\":\"2022-12-28T11:13:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/\"},\"wordCount\":548,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/how-to-install-and-use-composer-on-ubuntu-22-04.webp\",\"articleSection\":[\"Tutorials\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/\",\"name\":\"How to Install and Use Composer on Ubuntu 20.04 | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/how-to-install-and-use-composer-on-ubuntu-22-04.webp\",\"datePublished\":\"2022-10-05T17:30:32+00:00\",\"dateModified\":\"2022-12-28T11:13:01+00:00\",\"description\":\"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/how-to-install-and-use-composer-on-ubuntu-22-04.webp\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/how-to-install-and-use-composer-on-ubuntu-22-04.webp\",\"width\":742,\"height\":372,\"caption\":\"how to install and use composer on ubuntu 22.04\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-use-composer-on-ubuntu-20-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install and Use Composer on Ubuntu 20.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Install and Use Composer on Ubuntu 20.04 | RoseHosting","description":"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.","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.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/","og_locale":"en_US","og_type":"article","og_title":"How to Install and Use Composer on Ubuntu 20.04","og_description":"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2022-10-05T17:30:32+00:00","article_modified_time":"2022-12-28T11:13:01+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp","type":"image\/webp"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_title":"How to Install and Use Composer on Ubuntu 20.04","twitter_description":"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Install and Use Composer on Ubuntu 20.04","datePublished":"2022-10-05T17:30:32+00:00","dateModified":"2022-12-28T11:13:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/"},"wordCount":548,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp","articleSection":["Tutorials","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/","name":"How to Install and Use Composer on Ubuntu 20.04 | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp","datePublished":"2022-10-05T17:30:32+00:00","dateModified":"2022-12-28T11:13:01+00:00","description":"In this tutorial, we will install PHP 7.4 and Composer on Ubuntu 20.04 and try out Composer commands. Let\u2019s get started.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/09\/how-to-install-and-use-composer-on-ubuntu-22-04.webp","width":742,"height":372,"caption":"how to install and use composer on ubuntu 22.04"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-composer-on-ubuntu-20-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install and Use Composer on Ubuntu 20.04"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/41634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=41634"}],"version-history":[{"count":14,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/41634\/revisions"}],"predecessor-version":[{"id":43317,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/41634\/revisions\/43317"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/43145"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=41634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=41634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=41634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}