Skip to content

ParameterBag::class for managing key/value data #9

@arshavinel

Description

@arshavinel

Description

Note: Inspired from Symfony 6.


Bag\ParameterBag::class would store any data we need to reuse in other classes.
In that way, we guarantee that the format of received data follows a certain structure.

At least these public methods should be available:

  • clear, add, all, get, set, has, remove

The following classes should extend this class:

  • Bag\InputBag::class
  • Bag\FileBag::class
  • Bag\ServerBag::class

Example

use ArshWell\Monolith\Http\RequestObject;
use ArshWell\Monolith\Bag\InputBag;
use ArshWell\Monolith\Bag\FileBag;
use ArshWell\Monolith\Bag\ServerBag;

$request = new RequestObject(
    new InputBag($_GET), // query
    new InputBag($_POST), // request
    new InputBag($_COOKIE),
    new FileBag($_FILES),
    new ServerBag($_SERVER)
);

ArshWell Version

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions