Mezzio Documentation

website·Indexed 34 days ago

https://docs.mezzio.dev

Documentation for Mezzio, a PSR-7 middleware framework. Includes guides on application features, container integration (Aura.Di, Pimple), routing (FastRoute), and specialized components such as mezzio-authentication and mezzio-authentication-oauth2 (v1, v2, v3) for implementing authorization servers and various OAuth2 grants.

Tokens
220.1K
Snippets
974
Records
1.3K
Agent score
67%

What's inside Mezzio

  1. Overview of laminas-servicemanager

    v1
    laminas-servicemanager is a code-driven dependency injection container for Mezzio. It supports lazy-loading of invokable classes, custom factories, abstract factories for identical construction patterns, lazy-loading proxies, delegator factories for altering construction workflows, and interface injection via initializers.
  2. Overview of Mezzio PSR-7 Middleware Framework

    v2

    Mezzio is a minimalist PSR-7 middleware framework for PHP built on Stratigility. It provides a flexible structure that allows developers to choose their preferred tools for routing, dependency injection, and templating. Key features include:

    • Routing: Supports multiple routers including Aura.Router, FastRoute, and laminas-router.
    • Dependency Injection: Uses PSR-11 Containers to retrieve composed middleware.
    • Templating: Optional support for Plates, Twig, and Laminas's PhpRenderer.
    • Error Handling: Supports templated error pages and debugging tools like whoops.
    • Nested Applications: Allows writing an application and composing it within another, potentially under a separate subpath.
    • Simplified Installation: Provides a custom Composer-based installer that prompts for initial stack choices to create a tailored base.
  3. Overview of Mezzio PSR-7 Middleware Framework

    v1

    Mezzio is a minimalist PSR-7 middleware framework for PHP built on Stratigility. It is designed to provide minimal structure, allowing developers to choose their preferred tools for core functionality. Key features include:

    • Routing: Supports multiple routers including Aura.Router, FastRoute, and laminas-router.
    • Dependency Injection: Uses container-interop for DI containers, allowing all middleware to be retrieved from a composed container.
    • Templating: Optional support for Plates, Twig, and Laminas's PhpRenderer.
    • Error Handling: Supports templated error pages and debugging tools like whoops.
    • Composition: Supports nested middleware applications, allowing an application to be composed within another, optionally under a separate subpath.
    • Installation: Provides a custom Composer-based installer that prompts for initial stack choices to create a tailored base installation.
  4. Overview of Mezzio HTTP Basic Authentication

    v1
    The mezzio-authentication-basic component provides an HTTP Basic Authentication adapter for mezzio-authentication. This implementation requires both a username and a password, separated by a colon (:), following the standard browser implementation of HTTP Basic credentials.
  5. Overview of Mezzio Body Parsing Middleware

    v1
    Mezzio\Helper\BodyParams\BodyParamsMiddleware is a PSR-7 middleware that parses request bodies into parameters and returns a new request instance containing them. It uses a strategy pattern to match the request Content-Type and parse the body. By default, it supports application/x-www-form-urlencoded and application/json (including application/*+json).
  6. Overview of mezzio-flash messages

    Flash messages are self-expiring, session-based messages used to provide feedback to users after a redirect, such as when implementing the Post-Redirect-Get pattern. A message is created during one request and can be retrieved during the immediately following request; after that, the message is automatically removed and no longer available.
    // Creating a flash message in middleware
    $flashMessages->flash('form-complete', 'Thank you; your submission was recorded.');
    
    // Retrieving the message on the subsequent request
    $message = $flashMessages->getFlash('form-complete');
  7. Overview of mezzio-hal

    v2

    mezzio-hal provides tools to automate the creation of HAL payloads from PHP objects. It allows developers to model API resources with relational links and embedded child resources. Key components include:

    • Mezzio\Hal\Link: Value object for relational links.
    • Mezzio\Hal\HalResource: Value object describing an API resource and its links.
    • Mezzio\Hal\HalResponseFactory: Generates PSR-7 responses for HAL resources.
    • Mezzio\Hal\LinkGenerator: Generates Link instances based on application routes.
    • Mezzio\Hal\Metadata: Maps PHP objects to their HAL representations (e.g., defining which route to use for a 'self' link or which hydrator to use).
    • Mezzio\Hal\ResourceGenerator: Uses metadata to convert PHP objects into HalResource instances.
  8. Overview of available Mezzio Helpers

    v3

    Mezzio provides a set of helper utility classes and middleware to handle common application tasks. Available helpers include:

    • Body Params Middleware: For parsing request bodies.
    • Content-Length Middleware: (Available since mezzio-helpers 4.1.0) For managing content length headers.
    • UrlHelper: For generating URLs.
    • ServerUrlHelper: For generating server-specific URLs.
  9. Overview of laminas-servicemanager

    v3
    laminas-servicemanager is a code-driven dependency injection container for Mezzio. It supports lazy-loading of invokable classes, custom factories, abstract factories for shared construction patterns, lazy-loading proxies, delegator factories for altering construction workflows, and interface injection via initializers.