Search code examples
phpcomposer-phpphar

Is composer available as a set of PHP scripts?


I haven't found any way of installing composer on my shared hosting. I don't understand the insistence of using a phar, surely composer could comfortably be ported to plain PHP scripts? Is there such a port? Or a way of achieving the same?


Solution

  • A phar file is a PHP archive. So download the composer file locally and upload them to your server. You need only a PHP-Interpreter installed on your CLI.

    Then you can run them php composer.phar or without PHP if your host is correctly configured.

    http://php.net/manual/de/phar.using.intro.php

    https://getcomposer.org/download/

    Normally you can install composer with the given command on the composer site.

    php -r "readfile('https://getcomposer.org/installer');" | php