PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 4, 2022

[FIXED] How can I use Artifactory as a caching proxy for my PHP composer dependencies from packagist?

 January 04, 2022     artifactory, composer-php, php     No comments   

Issue

I want to use Artifactory as a caching proxy for my PHP composer dependencies.

I have been able to manually create a remote repository and configure composer to use Artifactory instead of packagist.

The problem is that my project has a lot of dependencies (because dependencies have dependencies).

It's going to be impossible to use Artifactory if I have to do this manually.

How can I create a mirror of all my dependencies (including indirect dependencies) starting from my composer.json?


Solution

A remote repository in Artifactory is usually used to mirror another repository / registry, serving multiple packages. There shouldn't be a need to setup a new remote repository for each dependency (i.e. package).

Since the majority of the packages in packagist.org are served from github.com, configuring a single remote repository that resolves the registry index files from packagist and the binaries from github should be enough.

If you depend on packages which are not hosted in github, you can simply add an additional remote repository that mirrors that other git provider. In this case you should also define a virtual repository that aggregates all the relevant repositories and use that one to resolve your dependencies.

For more details - see the documentation for PHP Composer Remote Repositories.



Answered By - yinon
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing