Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better approach to download php composer dependencies

I have been using maven in JAVA and started using PHP Maven, recently I switched to composer.

My project is with Zend Framework 2 and the team only checks in the application code not anything on the vendor directory. This is done to avoid conflicts and not to have the libraries under SVN.

Now each time a developer sets his or her new environment, we observe that, the composer pulls the dependencies from internet. This takes quite a long time.

Is there any better idea/approach to make this faster or handling the project in different way to avoid this problem?

maven uses maven proxy servers which can cache the download and can be used in the network again, but do we have any solutions to handle problems like this?

like image 891
sujaisd Avatar asked Dec 30 '12 01:12

sujaisd


People also ask

How do I get the composer JSON file?

To configure Composer for your PHP app json file specifies required packages. Verify that a composer. json file is present in the root of your git repository. Run composer install (on your local machine) to install the required packages and generate a composer.

Where does composer get packages from?

Composer will look in all your repositories to find the packages your project requires. By default, only the Packagist.org repository is registered in Composer. You can add more repositories to your project by declaring them in composer. json .

How do I download composer?

Under the "Installation - Windows" section, click on the "Using the Installer" option; it will take you to the "Using the Installer" section. b) Click on the Composer-Setup.exe link to download Composer setup on your device. After downloading the setup, run it to install and follow the instructions.


1 Answers

Composer is a very young project, so there might be things missing which e.g. Maven can co without hassle.

You could set up your own Packagist server as described in the composer docs. I believe packagist has some caching options which can be used to store packages on the packagist server.

What you also could do is fork your dependencies and push them to a company-owned private repository. In your composer.json you would now only use this dependencies, making it faster to clone. Of course this would require you to maintain all the different dependencies (although this could be done with a script and a cronjob, pulling the data from the github repo and pushing it into your company owned).

I also believe composer has some proxy options, but I don't think these are meant to cache dependencies.

Last option would be to develop something like this, either as part of composer/packagist or as stand-alone.

like image 199
Sgoettschkes Avatar answered Oct 03 '22 04:10

Sgoettschkes