git404hub

what is http-foundation fr?

symfony/http-foundation — explained in plain English

Analysis updated 2026-06-24

8,636PHPAudience · developerComplexity · 2/5Setup · easy

tl;dr

A PHP library that wraps HTTP requests and responses into clean objects, replacing PHP's scattered global variables with one structured way to read incoming data and build outgoing replies.

vibe map

mindmap
  root((HttpFoundation))
    What it does
      HTTP request wrapper
      HTTP response builder
      Replaces superglobals
    Classes
      Request
      Response
      Cookie
      Session
      UploadedFile
    Tech
      PHP
      Symfony ecosystem
    Audience
      PHP developers
      Framework builders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Read incoming query parameters, POST data, headers, and cookies from a single Request object instead of accessing PHP superglobals directly.

VIBE 2

Build and send HTTP responses with status codes, headers, and body content using a Response object with a clean API.

VIBE 3

Handle file uploads and session management in a PHP application using the structured classes this component provides.

what's the stack?

PHPSymfony

how it stacks up fr

symfony/http-foundationaimeos/aimeos-laravelsolidtime-io/solidtime
Stars8,6368,6238,555
LanguagePHPPHPPHP
Setup difficultyeasymoderatemoderate
Complexity2/53/53/5
Audiencedeveloperdeveloperpm founder

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 30min

Install via Composer, no external services required to start using the Request and Response classes.

in plain english

HttpFoundation is a PHP component from the Symfony project that wraps the HTTP request and response cycle in a set of PHP objects. HTTP is the protocol that web browsers and servers use to exchange data: a browser sends a request with information like a URL, headers, and optional form data, and the server sends back a response with a status code, headers, and the page content. In standard PHP, this information arrives as global variables and functions scattered across the language, such as the superglobal arrays for query string parameters and POST data, and separate header functions for controlling the response. HttpFoundation replaces that approach by providing a Request class that gathers all incoming data into one structured object, and a Response class for building and sending the reply in a controlled way. Related classes handle cookies, uploaded files, and sessions under the same structure. This is one of the foundational components of the Symfony web framework, but it is also distributed separately so other PHP projects can use it without adopting the full framework. Many PHP frameworks and tools depend on it directly. The README for this repository is minimal and primarily links to the full documentation and contribution guides on the Symfony website. Developers looking for usage examples and detailed API documentation should visit those links rather than the README itself. The component targets PHP developers building web applications who want a cleaner, more structured way to handle HTTP requests and responses.

prompts (copy fr)

prompt 1
Using Symfony HttpFoundation, write me a PHP script that reads a query parameter called 'username' from the request, validates it is not empty, and returns a JSON response with a 400 status if it is missing.
prompt 2
Show me how to set a cookie on an HttpFoundation Response object, including the expiry time and the httpOnly flag.
prompt 3
I am building a PHP app without the full Symfony framework. How do I install only the HttpFoundation component via Composer and create a Request object from the current browser request?
prompt 4
Using HttpFoundation's Session class, write me code that stores a user ID in a session after login and retrieves it on the next request to check if the user is authenticated.
prompt 5
How do I handle a file upload with Symfony HttpFoundation? Show me how to get the uploaded file from the Request object, check its MIME type, and move it to a storage directory.

Frequently asked questions

what is http-foundation fr?

A PHP library that wraps HTTP requests and responses into clean objects, replacing PHP's scattered global variables with one structured way to read incoming data and build outgoing replies.

What language is http-foundation written in?

Mainly PHP. The stack also includes PHP, Symfony.

How hard is http-foundation to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is http-foundation for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.