Skip to content

Better API design #8

@g105b

Description

@g105b

UploadData should be included in the Input's internal data collection, so that it can be referred to in exactly the same way as query string or request body parameters.

The added benefit of this means that callbacks can be passed dynamic functions that can benefit from the type juggling of PHP.

To achieve this, all parameters (apart from extras passed in to ->call()) need to be InputDatum types. An InputDatum is a representation of a single request KVP.

$input->do("update-settings")
	->with("username", "password", "profile-photo")
	->call("saveSettings");

function saveSettings(string $username, string $password, FileUpload $profilePhoto) {
	// Dynamic properties with correct type, juggled by PHP.
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions