PHP install package globally: apt-get vs composer

Asked
Active3 hr before
Viewed126 times

7 Answers

installpackage
90%

Using composer: composer global require symfony/finder The package will be located at ~/.config/composer/vendor/ , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers , Stack Overflow Public questions & answers ,Their package database, composer uses packagist and apt-get uses a selection of repositories and ppas (you can find them in /var/lib/apt/lists/).

Using composer:

composer global require symfony / finder
load more v
88%

I found there are two options to install PHP package globally in Linux (Ubuntu 16.04):,Why would I want to install package globally ?,The package will be located at ~/.config/composer/vendor/,Their focus in the packages they manage, composer is specific for php based packages but apt-get is for Linux and more system level oriented.

Using composer:

composer global require symfony / finder
load more v
72%

I found there are two options to install PHP package globally in Linux (Ubuntu 16.04):,Using composer: composer global require symfony/finder The package will be located at ~/.config/composer/vendor/ ,Why would I want to install package globally ?,The package will be located at ~/.config/composer/vendor/

Using composer:

composer global require symfony / finder
load more v
65%

Composer and all content on this site are released under the MIT license. ,This is the easiest way to get Composer set up on your machine.,Now that you've installed Composer, you are ready to use it! Head on over to the next chapter for a short demonstration.,Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

You can install Composer to a specific directory by using the --install-dir option and additionally (re)name it as well using the --filename option. When running the installer when following the Download page instructions add the following parameters:

php composer - setup.php--install - dir = bin--filename = composer
load more v
75%

Search Answer Titles

Open a terminal and navigate to your user directory, ie cd /User/<USER_NAME>/
   Run this command shown below to download Composer. This will create a Phar (PHP Archive) file called
   composer.phar:

   curl -sS https://getcomposer.org/installer | php

   Now we move
   composer.phar file to a directory
   sudo mv composer.phar /usr/local/bin/

   We want to run Composer with having to be root al the time, so we need to change the permissions:
   sudo chmod 755 /usr/local/bin/composer.phar

   Next, we need to let Bash know where to execute Composer:
   nano ~/.bash_profile

   Add this line below to bash_profile and save

   alias composer="php /usr/local/bin/composer.phar"
   and then run this command:

   source ~/.bash_profile

   Finally, run:
   composer -v
load more v
40%

PEAR was the first substantial package management system for PHP. However, PEAR has fallen out of favor with developers in recent years.,PHP Composer  is a package management system for PHP which prevents users from having to "reinvent the wheel" when it comes to commonly-used website components like user authentication or database management. Composer is modeled on other popular package management systems like Ruby's Bundler.,Install the curl utility:,Provide powerful and reliable service to your clients with a web hosting package from IONOS.

ser @localhost: ~# php - v
PHP 7.0 .13 - 0 ubuntu0 .16 .04 .1(cli)(NTS)
Copyright(c) 1997 - 2016 The PHP Group
Zend Engine v3 .0 .0, Copyright(c) 1998 - 2016 Zend Technologies
with Zend OPcache v7 .0 .13 - 0 ubuntu0 .16 .04 .1, Copyright(c) 1999 - 2016, by Zend Technologies
load more v
22%

To install a new php library or a package you need to know following commands: , To list all installed packages within a project run following commands: , Open linux terminal window and run following commands in order to install composer: , Open your mac terminal window and run following commands:

Open your mac terminal window and run following commands:

# get the composer phar file
curl - sS https: //getcomposer.org/installer | php

   # now we move composer.phar file to a executable directory
sudo mv composer.phar / usr / local / bin /

   # we need to
let our computer to run composer command globally
# in order to do that we need to add entry in our bash_profile file
   # open bash_profile file using nano editor
nano~/.bash_profile

# add this line below to bash_profile and save using CMD + x + Enter
alias composer = "php /usr/local/bin/composer.phar"

# once file is saved we need to run following command to activate our changes
source~/.bash_profile

#
finally, composer installed on mac os and you can verify using any of
   # the following commands
composer--version
composer--V
load more v

Other "install-package" queries related to "PHP install package globally: apt-get vs composer"