Skip to content

Deprecate Joomla\CMS\Http package #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Aug 15, 2025

User description

This is the documentation PR for joomla/joomla-cms#45751


PR Type

Documentation


Description

  • Add deprecation notice for Joomla\CMS\Http package

  • Document migration path to Joomla\Http framework package

  • Specify removal timeline (deprecated in 6.0, removed in 7.0)

  • Note PSR-7 method usage for Response object


Diagram Walkthrough

flowchart LR
  A["Joomla\CMS\Http"] -- "deprecated in 6.0" --> B["Migration Guide"]
  B -- "use instead" --> C["Joomla\Http Framework"]
  C -- "PSR-7 methods" --> D["Response Object"]
Loading

File Walkthrough

Relevant files
Documentation
new-deprecations.md
Add Http package deprecation documentation                             

migrations/54-60/new-deprecations.md

  • Add new "Class Deprecations" section
  • Document Joomla\CMS\Http package deprecation
  • Provide migration guidance to framework package
  • Specify PSR-7 method usage requirements
+5/-0     

Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Clarity

The note about PSR-7 methods for the Response object is vague; consider adding concrete examples of old vs new usage or linking to PSR-7 docs to prevent ambiguity for readers.

### `Joomla\CMS\Http` is deprecated

The whole `Joomla\CMS\Http` package is deprecated in Joomla 6.0 and will be removed in 7.0. Please use the Joomla Framework `Joomla\Http` package instead. The Framework package is an almost complete drop-in replacement. You only have to pay attention when accessing the data from the `Response` object. Don't read from the (magic) attributes, but use the PSR-7 methods instead.
Consistency

Confirm capitalization and naming consistency for package names (e.g., Joomla\Http vs Joomla Framework wording) and ensure deprecation/removal versions align with the linked core PR.

## Class Deprecations

### `Joomla\CMS\Http` is deprecated

The whole `Joomla\CMS\Http` package is deprecated in Joomla 6.0 and will be removed in 7.0. Please use the Joomla Framework `Joomla\Http` package instead. The Framework package is an almost complete drop-in replacement. You only have to pay attention when accessing the data from the `Response` object. Don't read from the (magic) attributes, but use the PSR-7 methods instead.

Copy link
Contributor

qodo-merge-pro bot commented Aug 15, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Highlight PSR-7 immutability requirements

Add an explicit note about request immutability to avoid silent bugs when
attempting to modify requests/responses in place. Point users to using with

methods instead of property mutation.
*

migrations/54-60/new-deprecations.md [18]

-The Framework package is an almost complete drop-in replacement.
+The Framework package is an almost complete drop-in replacement. Note that PSR-7 requests and responses are immutable; to modify them, use the `with*` methods, e.g. `withHeader()`, `withBody()`, `withStatus()`, rather than attempting to change properties in place.

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: This suggestion adds a critical warning about PSR-7 immutability, a common pitfall that can lead to subtle bugs, thereby making the migration guide much safer for developers.

Medium
Specify PSR-7 access patterns

Clarify which PSR-7 methods to use and explicitly warn that the response body is
a stream. Provide a brief example to prevent misuse of magic properties and
direct casting which can cause runtime errors.

migrations/54-60/new-deprecations.md [18]

-The whole `Joomla\CMS\Http` package is deprecated in Joomla 6.0 and will be removed in 7.0. Please use the Joomla Framework `Joomla\Http` package instead. The Framework package is an almost complete drop-in replacement. You only have to pay attention when accessing the data from the `Response` object. Don't read from the (magic) attributes, but use the PSR-7 methods instead.
+The whole `Joomla\CMS\Http` package is deprecated in Joomla 6.0 and will be removed in 7.0. Please use the Joomla Framework `Joomla\Http` package instead. The Framework package is an almost complete drop-in replacement. Pay particular attention when accessing data from the `Response` object: do not use magic properties; use PSR-7 methods instead (e.g. `getStatusCode()`, `getReasonPhrase()`, `getHeaders()`, `getHeaderLine('Content-Type')`, and `getBody()->getContents()`).
 
+Example:
+- Before: `$response->code`, `$response->headers`, `$response->body`
+- After: `$response->getStatusCode()`, `$response->getHeaders()`, `(string) $response->getBody()` or `$response->getBody()->getContents()`
+
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: This suggestion significantly improves the documentation by providing concrete examples of PSR-7 methods and a before/after comparison, making the migration guide clearer and more actionable for developers.

Medium
Add a safe migration example

Provide a minimal migration snippet to prevent misuse and ease transition,
showing instantiation and a simple GET with proper response handling. This
reduces runtime errors from incorrect usage.

migrations/54-60/new-deprecations.md [18]

 Please use the Joomla Framework `Joomla\Http` package instead.
 
+Minimal migration example:
+```
+use Joomla\Http\HttpFactory;
+
+$http = (new HttpFactory())->getHttp();
+$response = $http->get('https://example.com/api');
+
+$status  = $response->getStatusCode();
+$body    = (string) $response->getBody();
+$headers = $response->getHeaders();
+```
+

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: Providing a complete, minimal code example is highly valuable as it demonstrates the correct instantiation and usage pattern, which greatly aids developers in the migration process.

Medium
  • Update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants