Skip to content

Introduce a string service contract - #389

Merged
techmahedy merged 2 commits into
doppar:4.xfrom
techmahedy:string-service
Oct 30, 2026
Merged

techmahedy merged 2 commits into
doppar:4.xfrom
techmahedy:string-service

Conversation

@techmahedy

Copy link
Copy Markdown
Member

Pull Request Checklist

Q A
Branch? 4.x
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

Description

Introduce a string service contract so Doppar services can depend on an abstraction rather than the concrete StringService implementation. This follows the same pattern as the URL generator, storage, mail, hashing and encryption contracts.

Changes

  • Added Phaseolies\Support\Contracts\StringServiceInterface covering all 33 public StringService methods.
  • Updated StringService to implement the contract.
  • Made camel() and limitWords() explicitly public. They were implicitly public, so behavior is unchanged.
  • Bound the contract as a singleton in FacadeLauncher and kept str as an alias of it.
  • Changed the str() helper's return type to StringServiceInterface. It still resolves 'str'.
  • Updated the Str facade @see to reference the contract.
  • Added tests for contract conformance, and for the contract, 'str' and str() resolving to the same singleton.

Backward Compatibility

app('str'), the str() helper and the Str facade keep working. The contract and the str key resolve to the same singleton instance, and no method signatures changed.

str() keeps resolving 'str', not the interface. Several existing tests build a bare container with only 'str' bound, and resolving the interface there would fail.

Notes

As with the other aliased contracts, bind('str', ...) follows the alias and replaces the contract binding. Anything rebinding 'str' should return a StringServiceInterface implementation.

Checklist

  • Tests have been added or updated
  • Documentation has been updated if necessary
  • Code follows the project coding standards
  • All tests pass locally

@techmahedy
techmahedy merged commit 7d08fb9 into doppar:4.x Oct 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant