Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PHLAK/Twine
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.0.1
Choose a base ref
...
head repository: PHLAK/Twine
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Oct 15, 2019

  1. Added FUNDING file

    PHLAK authored Oct 15, 2019
    Copy the full SHA
    0d7863b View commit details
  2. Copy the full SHA
    05d82ee View commit details
  3. Updated badges

    PHLAK committed Oct 15, 2019
    Copy the full SHA
    bca9b3e View commit details

Commits on Oct 17, 2019

  1. Copy the full SHA
    3155126 View commit details

Commits on Oct 18, 2019

  1. Added CODEOWNERS file

    PHLAK authored Oct 18, 2019
    Copy the full SHA
    984e8a6 View commit details

Commits on Oct 19, 2019

  1. Added issue templates

    PHLAK authored Oct 19, 2019
    Copy the full SHA
    ef18176 View commit details
  2. Copy the full SHA
    3212bb6 View commit details
  3. Added Str::match() and Str::matchAll() methods

    Resolves issue #37
    PHLAK committed Oct 19, 2019
    Copy the full SHA
    6509a4c View commit details
  4. Copy the full SHA
    2bd304a View commit details
  5. Fixed: Encoding was not preserved when returning a new instance of th…

    …e Str class from a method
    PHLAK committed Oct 19, 2019
    Copy the full SHA
    2f114b0 View commit details
  6. Copy the full SHA
    c9b96e7 View commit details

Commits on Nov 29, 2019

  1. Updated README

    PHLAK committed Nov 29, 2019
    Copy the full SHA
    2ddbb74 View commit details
  2. Added .editorconfig file

    PHLAK committed Nov 29, 2019
    Copy the full SHA
    cb043e3 View commit details

Commits on Dec 3, 2019

  1. Fixed StyleCI

    PHLAK committed Dec 3, 2019
    Copy the full SHA
    2cb7bd3 View commit details

Commits on Dec 4, 2019

  1. Copy the full SHA
    277e33e View commit details
  2. Copy the full SHA
    d0cba80 View commit details
  3. Copy the full SHA
    ed03cf1 View commit details

Commits on Mar 20, 2020

  1. Fixed some test class names

    PHLAK committed Mar 20, 2020
    Copy the full SHA
    8042a9f View commit details
  2. Updated dependencies

    PHLAK committed Mar 20, 2020
    Copy the full SHA
    efcf2af View commit details
  3. Copy the full SHA
    89fa0b7 View commit details
  4. Updated README

    PHLAK committed Mar 20, 2020
    Copy the full SHA
    4c18f9d View commit details
  5. Updated TravisCI config

    PHLAK committed Mar 20, 2020
    Copy the full SHA
    f3115ea View commit details
  6. php-cs-fixer

    PHLAK committed Mar 20, 2020
    Copy the full SHA
    8f45a5c View commit details
  7. Copy the full SHA
    888b544 View commit details
  8. Copy the full SHA
    34eabed View commit details
  9. Static analysis fix

    PHLAK committed Mar 20, 2020
    Copy the full SHA
    d309379 View commit details
  10. Copy the full SHA
    dd2e02d View commit details
  11. Copy the full SHA
    362215d View commit details

Commits on May 6, 2020

  1. Fix typos in readme

    mtsknn authored May 6, 2020
    Copy the full SHA
    e2cde12 View commit details
  2. Merge pull request #39 from mtsknn/patch-1

    Fix typos in readme
    PHLAK authored May 6, 2020
    Copy the full SHA
    11e9c09 View commit details

Commits on Jul 14, 2020

  1. Fixed/updated README

    PHLAK committed Jul 14, 2020
    Copy the full SHA
    f830b16 View commit details
  2. Copy the full SHA
    8e7ce66 View commit details
  3. Updated psaml baseline

    PHLAK committed Jul 14, 2020
    Copy the full SHA
    7e2eb60 View commit details
  4. Copy the full SHA
    f4699d8 View commit details

Commits on Sep 2, 2020

  1. Add MBSTRING Extension Required to composer.json

    Since Twine relies on PHP's multi-byte string (mb_*) functions available (only) when the MBSTRING extension for PHP is loaded, add MBSTRING extension requirement to composer.json. Reference #41
    Ben Roberts authored Sep 2, 2020
    Copy the full SHA
    776ca11 View commit details
  2. Update README.md With Multi-Byte String Details

    Consider adding some details about multi-byte string support in Twine to README.md.
    Ben Roberts authored Sep 2, 2020
    Copy the full SHA
    ee4ddaf View commit details

Commits on Sep 3, 2020

  1. Merge pull request #42 from broberts-mrmc/patch-1

    Add MBSTRING Extension Required to composer.json
    PHLAK authored Sep 3, 2020
    Copy the full SHA
    d4eb7fb View commit details
  2. Merge pull request #43 from broberts-mrmc/patch-3

    Update README.md With Multi-Byte String Details
    PHLAK authored Sep 3, 2020
    Copy the full SHA
    a2ff5f1 View commit details
  3. Copy the full SHA
    0b32201 View commit details
  4. Copy the full SHA
    3b2488b View commit details
  5. multi-byte -> multibyte

    PHLAK committed Sep 3, 2020
    Copy the full SHA
    59f1df8 View commit details
  6. Copy the full SHA
    fb0dc70 View commit details
  7. Copy the full SHA
    4d589e9 View commit details

Commits on Oct 6, 2020

  1. Copy the full SHA
    cc2dcd9 View commit details

Commits on Oct 21, 2020

  1. Update dependabot.yml

    PHLAK authored Oct 21, 2020
    Copy the full SHA
    f774f86 View commit details
  2. Merge pull request #44 from PHLAK/dependabot/add-v2-config-file

    Create Dependabot config file
    PHLAK authored Oct 21, 2020
    Copy the full SHA
    079a8be View commit details

Commits on Nov 25, 2020

  1. Updated dependencies

    PHLAK committed Nov 25, 2020
    Copy the full SHA
    2161316 View commit details
  2. Copy the full SHA
    5c19fca View commit details
  3. Updated travis config

    PHLAK committed Nov 25, 2020
    Copy the full SHA
    4e99895 View commit details
  4. Copy the full SHA
    b4d28f2 View commit details
Showing with 2,206 additions and 1,447 deletions.
  1. +20 −0 .editorconfig
  2. +1 −0 .gitattributes
  3. +1 −0 .github/CODEOWNERS
  4. +2 −0 .github/FUNDING.yml
  5. +33 −0 .github/ISSUE_TEMPLATE/bug_report.yaml
  6. +20 −0 .github/ISSUE_TEMPLATE/feature_request.yaml
  7. +15 −0 .github/dependabot.yml
  8. +68 −0 .github/workflows/test-suite.yaml
  9. +1 −1 .gitignore
  10. +10 −0 .php-cs-fixer.dist.php
  11. +0 −35 .php_cs.dist
  12. +0 −20 .styleci.yml
  13. +0 −28 .travis.yml
  14. +1 −1 LICENSE
  15. +43 −18 README.md
  16. +17 −4 composer.json
  17. +19 −0 phpstan-baseline.neon
  18. +9 −0 phpstan.neon.dist
  19. +11 −7 phpunit.xml
  20. +3 −3 src/Config/Base64.php
  21. +3 −3 src/Config/Characters.php
  22. +0 −30 src/Config/Config.php
  23. +3 −3 src/Config/Equals.php
  24. +3 −3 src/Config/Hex.php
  25. +3 −3 src/Config/In.php
  26. +4 −4 src/Config/Lowercase.php
  27. +3 −3 src/Config/Md5.php
  28. +4 −4 src/Config/Pad.php
  29. +3 −3 src/Config/Sha1.php
  30. +3 −3 src/Config/Sha256.php
  31. +3 −9 src/Config/Str.php
  32. +4 −4 src/Config/Trim.php
  33. +4 −4 src/Config/Uppercase.php
  34. +3 −3 src/Config/Url.php
  35. +3 −3 src/Config/Wrap.php
  36. +1 −3 src/Exceptions/ConfigException.php
  37. +1 −3 src/Exceptions/DecryptionException.php
  38. +1 −3 src/Exceptions/EncryptionException.php
  39. +1 −3 src/Exceptions/TwineException.php
  40. +45 −52 src/Str.php
  41. +5 −5 src/Support/Str.php
  42. +2 −0 src/Support/helpers.php
  43. +31 −83 src/Traits/Aliases.php
  44. +6 −14 src/Traits/ArrayAccess.php
  45. +42 −92 src/Traits/Caseable.php
  46. +17 −21 src/Traits/Comparable.php
  47. +20 −39 src/Traits/Convenience.php
  48. +24 −41 src/Traits/Encodable.php
  49. +27 −21 src/Traits/Encryptable.php
  50. +15 −31 src/Traits/Hashable.php
  51. +6 −10 src/Traits/Joinable.php
  52. +34 −0 src/Traits/Searchable.php
  53. +27 −38 src/Traits/Segmentable.php
  54. +42 −70 src/Traits/Transformable.php
  55. +16 −48 src/Traits/Typeable.php
  56. +8 −2 tests/ArrayAccessTest.php
  57. +0 −20 tests/Config/Base64Test.php
  58. +0 −20 tests/Config/EqualsTest.php
  59. +0 −20 tests/Config/HexTest.php
  60. +0 −21 tests/Config/LowercaseTest.php
  61. +0 −20 tests/Config/Md5Test.php
  62. +0 −21 tests/Config/PadTest.php
  63. +0 −20 tests/Config/Sha1Test.php
  64. +0 −20 tests/Config/Sha256Test.php
  65. +8 −5 tests/Config/StrTest.php
  66. +0 −21 tests/Config/TrimTest.php
  67. +0 −21 tests/Config/UppercaseTest.php
  68. +0 −20 tests/Config/WrapTest.php
  69. +7 −2 tests/ConfigExceptionTest.php
  70. +7 −3 tests/DecryptionExceptionTest.php
  71. +7 −2 tests/EncryptionExceptionTest.php
  72. +20 −4 tests/Methods/AfterTest.php
  73. +20 −4 tests/Methods/AppendTest.php
  74. +8 −3 tests/Methods/Base64DecodeTest.php
  75. +8 −3 tests/Methods/Base64EncodeTest.php
  76. +12 −15 tests/Methods/Base64Test.php
  77. +22 −7 tests/Methods/BcryptTest.php
  78. +20 −4 tests/Methods/BeforeTest.php
  79. +18 −3 tests/Methods/CamelCaseTest.php
  80. +21 −4 tests/Methods/CharactersTest.php
  81. +19 −3 tests/Methods/ChunkTest.php
  82. +8 −3 tests/Methods/ContainsTest.php
  83. +8 −3 tests/Methods/CountTest.php
  84. +8 −3 tests/Methods/Crc32Test.php
  85. +17 −3 tests/Methods/CryptTest.php
  86. +21 −5 tests/Methods/DecryptTest.php
  87. +19 −3 tests/Methods/EchoTest.php
  88. +7 −3 tests/Methods/EncodingTest.php
  89. +22 −6 tests/Methods/EncryptTest.php
  90. +12 −5 tests/Methods/EndsWithTest.php
  91. +12 −5 tests/Methods/EqualsTest.php
  92. +28 −10 tests/Methods/ExplodeTest.php
  93. +18 −3 tests/Methods/FirstTest.php
  94. +17 −3 tests/Methods/FormatTest.php
  95. +20 −4 tests/Methods/FromTest.php
  96. +7 −3 tests/Methods/HexDecodeTest.php
  97. +7 −3 tests/Methods/HexEncodeTest.php
  98. +14 −7 tests/Methods/HexTest.php
  99. +12 −5 tests/Methods/InTest.php
  100. +7 −3 tests/Methods/InsensitiveMatchTest.php
  101. +18 −3 tests/Methods/InsertTest.php
  102. +10 −4 tests/Methods/IsAlphabeticTest.php
  103. +10 −4 tests/Methods/IsAlphanumericTest.php
  104. +10 −4 tests/Methods/IsEmptyTest.php
  105. +10 −4 tests/Methods/IsLowercaseTest.php
  106. +10 −4 tests/Methods/IsNotEmptyTest.php
  107. +10 −4 tests/Methods/IsNumericTest.php
  108. +10 −4 tests/Methods/IsPrintableTest.php
  109. +10 −4 tests/Methods/IsPunctuationTest.php
  110. +10 −4 tests/Methods/IsUppercaseTest.php
  111. +10 −4 tests/Methods/IsWhitespaceTest.php
  112. +21 −4 tests/Methods/JoinTest.php
  113. +18 −3 tests/Methods/KebabCaseTest.php
  114. +18 −3 tests/Methods/LastTest.php
  115. +7 −3 tests/Methods/LengthTest.php
  116. +18 −3 tests/Methods/LowercaseFirstTest.php
  117. +22 −15 tests/Methods/LowercaseTest.php
  118. +18 −3 tests/Methods/LowercaseWordsTest.php
  119. +57 −0 tests/Methods/MatchAllTest.php
  120. +51 −0 tests/Methods/MatchTest.php
  121. +10 −4 tests/Methods/MatchesTest.php
  122. +19 −5 tests/Methods/Md5Test.php
  123. +20 −4 tests/Methods/NthTest.php
  124. +17 −3 tests/Methods/PadBothTest.php
  125. +17 −3 tests/Methods/PadLeftTest.php
  126. +17 −3 tests/Methods/PadRightTest.php
  127. +26 −19 tests/Methods/PadTest.php
  128. +18 −3 tests/Methods/PascalCaseTest.php
  129. +20 −4 tests/Methods/PrependTest.php
  130. +20 −4 tests/Methods/RepeatTest.php
  131. +20 −4 tests/Methods/ReplaceTest.php
  132. +24 −9 tests/Methods/ReverseTest.php
  133. +19 −5 tests/Methods/Sha1Test.php
  134. +19 −5 tests/Methods/Sha256Test.php
  135. +19 −5 tests/Methods/ShuffleTest.php
  136. +9 −5 tests/Methods/SimilarityTest.php
  137. +18 −3 tests/Methods/SnakeCaseTest.php
  138. +19 −3 tests/Methods/SplitTest.php
  139. +13 −6 tests/Methods/StartsWithTest.php
  140. +20 −4 tests/Methods/StripTest.php
  141. +18 −3 tests/Methods/StudlyCaseTest.php
  142. +18 −3 tests/Methods/SubstringTest.php
  143. +20 −4 tests/Methods/ToTest.php
  144. +17 −3 tests/Methods/TrimLeftTest.php
  145. +17 −3 tests/Methods/TrimRightTest.php
  146. +26 −17 tests/Methods/TrimTest.php
  147. +24 −8 tests/Methods/TruncateTest.php
  148. +18 −3 tests/Methods/UppercaseFirstTest.php
  149. +22 −15 tests/Methods/UppercaseTest.php
  150. +18 −3 tests/Methods/UppercaseWordsTest.php
  151. +24 −7 tests/Methods/UrlTest.php
  152. +19 −3 tests/Methods/WordsTest.php
  153. +16 −2 tests/Methods/WrapHardTest.php
  154. +16 −2 tests/Methods/WrapSoftTest.php
  155. +21 −5 tests/Methods/WrapTest.php
  156. +36 −21 tests/StrTest.php
  157. +12 −5 tests/Support/StrTest.php
  158. +0 −18 tests/TestCase.php
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.json]
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
indent_style = space
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs.dist export-ignore
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @PHLAK
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: PHLAK
custom: https://paypal.me/ChrisKankiewicz
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Bug Report
description: Report something that is broken or not working as expected
labels: [Bug]
assignees: [PHLAK]

body:
- type: input
id: library-version
attributes:
label: Twine Version
description: What version of Twine are you using?
validations:
required: true

- type: input
id: php-version
attributes:
label: PHP Version
description: |
What version of PHP do you have installed?
Run `php --version` from a command line to find your version.
validations:
required: true

- type: textarea
id: description
attributes:
label: Describe the Bug
description: |
A description of the observed behavior and any other context about the problem.
Error logs and/or steps required to reproduce the error would be helpful here.
validations:
required: true
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Feature Request
description: Suggest an idea or an enhancement
labels: [Enhancement]
assignees: [PHLAK]

body:
- type: textarea
id: description
attributes:
label: Describe the feature or enhancement
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: Additional context
description: List any additional context about the feature or alternative soltions you have considered.
validations:
required: false
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

updates:

- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
assignees: [PHLAK]

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
assignees: [PHLAK]
68 changes: 68 additions & 0 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Twine Test Suite
on: [push, pull_request, workflow_dispatch]

jobs:
coding-standards:
name: Coding Standards
runs-on: 'ubuntu-latest'

env:
PHP_CS_FIXER_IGNORE_ENV: 1

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'

- name: Install PHP Dependencies
run: composer install --no-interaction --no-progress --no-scripts --prefer-dist

- name: Verify Coding Standards
run: vendor/bin/php-cs-fixer fix --diff --dry-run

static-analysis:
name: Static Analysis
runs-on: 'ubuntu-latest'

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'

- name: Install PHP Dependencies
run: composer install --no-interaction --no-progress --no-scripts --prefer-dist

- name: Run Static Analysis
run: vendor/bin/phpstan analyze

tests:
name: Tests
runs-on: 'ubuntu-latest'

strategy:
matrix:
php-versions: ['8.2', '8.3', '8.4']

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug

- name: Install PHP Dependencies
run: composer install --no-interaction --no-progress --no-scripts --prefer-dist

- name: Run Tests
run: vendor/bin/phpunit --coverage-text
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
composer.lock
/vendor/
10 changes: 10 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

require __DIR__ . '/vendor/autoload.php';

$finder = PhpCsFixer\Finder::create()->in([
__DIR__ . DIRECTORY_SEPARATOR . 'src',
__DIR__ . DIRECTORY_SEPARATOR . 'tests',
]);

return PHLAK\CodingStandards\ConfigFactory::make($finder);
35 changes: 0 additions & 35 deletions .php_cs.dist

This file was deleted.

20 changes: 0 additions & 20 deletions .styleci.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Chris Kankiewicz <Chris@ChrisKankiewicz.com>
Copyright (c) 2024 Chris Kankiewicz <Chris@ChrisKankiewicz.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
61 changes: 43 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,33 +3,33 @@
</p>

<p align="center">
<a href="https://packagist.org/packages/PHLAK/Twine"><img src="https://img.shields.io/packagist/v/PHLAK/Twine.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/PHLAK/Twine"><img src="https://img.shields.io/packagist/dt/PHLAK/Twine.svg" alt="Total Downloads"></a>
<a href="https://www.ChrisKankiewicz.com"><img src="https://img.shields.io/badge/author-Chris%20Kankiewicz-blue.svg" alt="Author"></a>
<a href="https://packagist.org/packages/PHLAK/Twine"><img src="https://img.shields.io/packagist/l/PHLAK/Twine.svg" alt="License"></a>
<a href="https://travis-ci.org/PHLAK/Twine"><img src="https://img.shields.io/travis/PHLAK/Twine.svg" alt="Build Status"></a>
<a href="https://styleci.io/repos/95623990"><img src="https://styleci.io/repos/95623990/shield?branch=master&style=flat" alt="StyleCI"></a>
String manipulation, leveled up! -- by, <a href="https://www.ChrisKankiewicz.com">Chris Kankiewicz</a> (<a href="https://bsky.app/profile/phlak.dev">@phlak.dev</a>)
</p>

<p align="center">
String manipulation, leveled up! -- by, <a href="https://www.ChrisKankiewicz.com">Chris Kankiewicz</a> (<a href="https://twitter.com/PHLAK">@PHLAK</a>)
<a href="https://github.com/PHLAK/Twine/discussions"><img src="https://img.shields.io/badge/Join_the-Community-7b16ff.svg?style=for-the-badge" alt="Join the Community"></a>
<a href="https://github.com/users/PHLAK/sponsorship"><img src="https://img.shields.io/badge/Become_a-Sponsor-cc4195.svg?style=for-the-badge" alt="Become a Sponsor"></a>
<a href="https://paypal.me/ChrisKankiewicz"><img src="https://img.shields.io/badge/Make_a-Donation-006bb6.svg?style=for-the-badge" alt="One-time Donation"></a>
<br>
<a href="https://packagist.org/packages/PHLAK/Twine"><img src="https://img.shields.io/packagist/v/phlak/twine.svg?style=flat-square" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/PHLAK/Twine"><img src="https://img.shields.io/packagist/dt/phlak/twine.svg?style=flat-square" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/PHLAK/Twine"><img src="https://img.shields.io/packagist/l/phlak/twine.svg?style=flat-square" alt="License"></a>
<a href="https://github.com/PHLAK/Twine/actions"><img src="https://img.shields.io/github/actions/workflow/status/PHLAK/Twine/test-suite.yaml?style=flat-square" alt="Test Suite"></a>
</p>

---

Introduction
------------

Twine is a simple string manipulation library with an expressive, fluent syntax.

#### Like this project?

[![Join the community on Spectrum](https://img.shields.io/badge/Join_the_community-PHLAKNET-7a15fe.svg)](https://spectrum.chat/phlaknet)
[![Become a Patron](https://img.shields.io/badge/Become_a-Patron-f96854.svg)](https://patreon.com/PHLAK)
[![One-time Donation](https://img.shields.io/badge/Make_a-Donation-006bb6.svg)](https://paypal.me/ChrisKankiewicz)
Twine is a string manipulation library with an expressive, fluent syntax.

Requirements
------------

- [PHP](https://php.net) >= 7.2
- [PHP](https://php.net) >= 8.1
- The [Multibyte String](https://www.php.net/manual/en/book.mbstring.php) extension
- The [OpenSSL](https://www.php.net/manual/en/book.openssl.php) extension

Install with Composer
---------------------
@@ -68,7 +68,7 @@ $string = str('john pinkerton');
```

Once you have a concrete `Twine\Str` instance you may treat it like any other
string. This includes echoing it or using any of PHP's built in string functions
string. This includes echoing it or using any of PHP's built-in string functions
against it.

```php
@@ -79,8 +79,23 @@ str_shuffle($string) // Returns something like 'enoipo ktnjhnr'
strlen($string); // Returns 14
```

The strength of Twine, however comes from its built-in methods.

```php
$string->echo(); // Echos 'john pinkerton'
$string->shuffle(); // Returns something like 'enoipo ktnjhnr'
$string->length(); // Returns 14

// or some more interesting methods

$string->reverse(); // Returns 'notreknip nhoj'
$string->contains('pink'); // Returns true
$string->replace('pink', 'purple'); // Returns 'john purpleton'
$string->snakeCase(); // Returns 'john_pinkerton'
```

At this point you're ready to start using Twine by calling any of its many
built in methods.
built-in methods.

Available Methods
-----------------
@@ -132,6 +147,8 @@ Available Methods
[lowercase](https://twine.phlak.net/docs/methods/lowercase)
[lowercaseFirst](https://twine.phlak.net/docs/methods/lowercasefirst)
[lowercaseWords](https://twine.phlak.net/docs/methods/lowercasewords)
[match](https://twine.phlak.net/docs/methods/match)
[matchAll](https://twine.phlak.net/docs/methods/matchall)
[matches](https://twine.phlak.net/docs/methods/matches)
[md5](https://twine.phlak.net/docs/methods/md5)
[nth](https://twine.phlak.net/docs/methods/nth)
@@ -194,6 +211,14 @@ $string->base64()->wrap(76, "\r\n", Twine\Config\Wrap::HARD);

Additional details available in the full documentation at <https://twine.phlak.net>.

MultiByte Strings
-----------------

Twine aims for multibyte string compatibility by relying on PHP's
[Multibyte String extension](https://www.php.net/manual/en/book.mbstring.php)
(mbstring) to perform string operations. For this reason, the mbstring extension
is required. Multibyte strings include Unicode encodings such as UTF-8 and UCS-2.

Changelog
---------

@@ -202,7 +227,7 @@ A list of changes can be found on the [GitHub Releases](https://github.com/PHLAK
Troubleshooting
---------------

For general help and support join our [Spectrum community](https://spectrum.chat/phlaknet).
For general help and support join our [GitHub Discussion](https://github.com/PHLAK/Twine/discussions) or reach out on [Bluesky](https://bsky.app/profile/phlak.dev).

Please report bugs to the [GitHub Issue Tracker](https://github.com/PHLAK/Twine/issues).

Loading