Skip to content

Add function versions of all formatters for simpler syntax #18

@henriquemoody

Description

@henriquemoody

Summary

Add function versions of all formatters to provide a simpler, more ergonomic API for common formatting tasks.

Usage Example

Instead of writing:

new PlaceholderFormatter(['foo' => true, 'bar' => [1, 2, 3]])->format('{{foo}} must be {{bar|list:or}}')

Users should be able to write:

formatter_placeholder('{{foo}} must be {{bar|list:or}}', ['foo' => true, 'bar' => [1, 2, 3]])

Desired Behavior

Create standalone functions for each formatter type that wrap the existing builder pattern, making the API more concise for common use cases.

Acceptance Criteria

  • Add function versions for all formatters
  • Functions should accept format string and any scalar value
  • Include tests for new functions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions