PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
26 Apr 2026

Pull Request resolves # .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Currently, creating a HTTP object in Joomla to make http requests requires repetitive boilerplate code like below across our code base to populate userAgent:

$version    = new Version();
$httpOption = new Registry();
$httpOption->set('userAgent', $version->getUserAgent('Joomla', true, false));

try {
	$http     = (new HttpFactory())->getHttp($httpOption);
	$response = $http->get($url);
} catch (\RuntimeException) {
	$response = null;
}

It is even more boilerplate code if we want to support proxy options ( Outbound Proxy was supported when we use Joomla CMS Http package, but was lost when we migrated our code to use framework Http package)

This PRs address that limitation by:

  • Introduce HttpClientFactory to create http object with options use userAgent, proxy pre-populated (if not specified by client code)
  • Make the http factory accessible from container
  • Inject http factory and make it auto-injected to controllers/models when it is needed

I made a sample change to LanguagesModel to show how to use the Http factory to create http object (the new way). If this PR is accepted, I will make a new PR to convert all existing code in Joomla to use the new http factory to create http object.

Testing Instructions

  • Use Joomla 6.2
  • Apply patch
  • Access to System -> Languages -> Install Languages, make languages are loaded properly

Actual result BEFORE applying this Pull Request

  • Works. But we have to write boilerplate/repeating same code in Joomla to create Http object

Expected result AFTER applying this Pull Request

  • Works. Not having to write boilerplate code to create Http object anymore. Plus, it is ready to support outbound proxy in Joomla again (there are changes in Joomla framework package is needed, I saw a PR for that already available)

Link to documentations

Please select:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

avatar joomdonation joomdonation - open - 26 Apr 2026
avatar joomdonation joomdonation - change - 26 Apr 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Apr 2026
Category Administration com_installer Libraries
avatar joomdonation joomdonation - change - 26 Apr 2026
Labels Added: PR-6.2-dev

Add a Comment

Login with GitHub to post a comment