Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Deploy Jekyll documentation to GitHub Pages
name: Deploy Documentation

on:
push:
branches: ["main"]
paths:
- 'docs/**'
- '.github/workflows/pages.yml'
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
!README.md
!CONTRIBUTING.md
!CHANGELOG.md
!docs/
!docs/**

# ========================================
# SOURCE CODE & TESTS
Expand Down
6 changes: 6 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "jekyll", "~> 4.3"
gem "just-the-docs", "~> 0.10"
gem "jekyll-seo-tag"
gem "jekyll-sitemap"
Comment on lines +1 to +6
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Great work on setting up the Gemfile! I have a couple of suggestions to improve consistency between your local development environment and the GitHub Pages build environment:

  1. Specify Ruby Version: It's a good practice to add a ruby version declaration. This ensures all developers and the CI environment use the same Ruby version, preventing potential dependency mismatches.
  2. Pin Theme Version: Your _config.yml pins the just-the-docs theme to version v0.10.1. To ensure local builds are identical to the deployed site, it's best to pin the gem to the same version here.
ruby "3.1.2" # Please adjust to match your GitHub Actions workflow version

source "https://rubygems.org"

gem "jekyll", "~> 4.3"
gem "just-the-docs", "0.10.1"
gem "jekyll-seo-tag"
gem "jekyll-sitemap"

74 changes: 74 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Site settings
title: StringManipulation
description: High-performance PHP 8.3+ string manipulation library featuring O(n) algorithms with up to 5x speed improvements
baseurl: "/StringManipulation"
url: "https://marjovanlier.github.io"

# Theme
remote_theme: just-the-docs/just-the-docs@v0.10.1

# Colour scheme
color_scheme: light

# Logo
logo: "/assets/images/logo.svg"

# Aux links
aux_links:
"GitHub":
- "https://github.com/MarjovanLier/StringManipulation"
"Packagist":
- "https://packagist.org/packages/marjovanlier/stringmanipulation"

aux_links_new_tab: true

# Footer
footer_content: "Copyright © 2024 Marjo Wenzel van Lier. Distributed under the MIT License."

# Back to top link
back_to_top: true
back_to_top_text: "Back to top"

# Heading anchor links
heading_anchors: true

# Search
search_enabled: true
search:
heading_level: 2
previews: 3
preview_words_before: 5
preview_words_after: 10
tokenizer_separator: /[\s/]+/
rel_url: true
button: false

# Navigation
nav_sort: case_insensitive

# Collections for pages
collections:
api:
permalink: "/:collection/:path/"
output: true

# Default front matter
defaults:
- scope:
path: ""
type: "api"
values:
layout: "default"
parent: "API Reference"

# Plugins
plugins:
- jekyll-seo-tag
- jekyll-sitemap

# Exclude from processing
exclude:
- Gemfile
- Gemfile.lock
- node_modules
- vendor
66 changes: 66 additions & 0 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
layout: default
title: API Reference
nav_order: 3
has_children: true
---

# API Reference
{: .no_toc }

Complete documentation for all public methods in the StringManipulation library.
{: .fs-6 .fw-300 }

---

## Overview

The `StringManipulation` class provides static methods for high-performance string operations. All methods are designed with O(n) complexity for predictable, scalable performance.

```php
use MarjovanLier\StringManipulation\StringManipulation;
```

---

## Methods at a Glance

| Method | Description | Performance |
|:----------------------------------------------------------------------|:---------------------------------------------|:-----------------|
| [`removeAccents()`]({{ site.baseurl }}/api-reference/remove-accents/) | Strip accents and diacritics from text | ~450,000 ops/sec |
| [`searchWords()`]({{ site.baseurl }}/api-reference/search-words/) | Transform text for search optimisation | ~195,000 ops/sec |
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "optimisation" should be "optimization" for consistency with American English spelling.

Suggested change
| [`searchWords()`]({{ site.baseurl }}/api-reference/search-words/) | Transform text for search optimisation | ~195,000 ops/sec |
| [`searchWords()`]({{ site.baseurl }}/api-reference/search-words/) | Transform text for search optimization | ~195,000 ops/sec |

Copilot uses AI. Check for mistakes.
| [`nameFix()`]({{ site.baseurl }}/api-reference/name-fix/) | Standardise names with proper capitalisation | ~130,000 ops/sec |
| [`utf8Ansi()`]({{ site.baseurl }}/api-reference/utf8-ansi/) | Convert UTF-8 to ANSI encoding | - |
| [`isValidDate()`]({{ site.baseurl }}/api-reference/is-valid-date/) | Validate date strings with format checking | - |
| [`strReplace()`]({{ site.baseurl }}/api-reference/str-replace/) | Optimised string replacement | - |
Comment on lines +31 to +35
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "Optimisation" should be "Optimization" for consistency with American English spelling.

Suggested change
| [`searchWords()`]({{ site.baseurl }}/api-reference/search-words/) | Transform text for search optimisation | ~195,000 ops/sec |
| [`nameFix()`]({{ site.baseurl }}/api-reference/name-fix/) | Standardise names with proper capitalisation | ~130,000 ops/sec |
| [`utf8Ansi()`]({{ site.baseurl }}/api-reference/utf8-ansi/) | Convert UTF-8 to ANSI encoding | - |
| [`isValidDate()`]({{ site.baseurl }}/api-reference/is-valid-date/) | Validate date strings with format checking | - |
| [`strReplace()`]({{ site.baseurl }}/api-reference/str-replace/) | Optimised string replacement | - |
| [`searchWords()`]({{ site.baseurl }}/api-reference/search-words/) | Transform text for search optimization | ~195,000 ops/sec |
| [`nameFix()`]({{ site.baseurl }}/api-reference/name-fix/) | Standardise names with proper capitalisation | ~130,000 ops/sec |
| [`utf8Ansi()`]({{ site.baseurl }}/api-reference/utf8-ansi/) | Convert UTF-8 to ANSI encoding | - |
| [`isValidDate()`]({{ site.baseurl }}/api-reference/is-valid-date/) | Validate date strings with format checking | - |
| [`strReplace()`]({{ site.baseurl }}/api-reference/str-replace/) | Optimized string replacement | - |

Copilot uses AI. Check for mistakes.
| [`trim()`]({{ site.baseurl }}/api-reference/trim/) | Remove characters from string ends | - |
Comment on lines +33 to +36
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The performance for utf8Ansi(), isValidDate(), strReplace(), and trim() is marked as -. While their performance is indeed input-dependent, it would be beneficial to provide some context or a typical performance range if possible, similar to the other methods. If not, it might be worth adding a footnote explaining why these are not benchmarked (e.g., "Performance is highly dependent on input size and complexity"). This would provide more clarity to the users.


---

## Null Handling

Methods handle null input consistently:

| Method | Null Input | Returns |
|:-------|:-----------|:--------|
| `searchWords()` | `null` | `null` |
| `nameFix()` | `null` | `null` |
| `utf8Ansi()` | `null` | `''` (empty string) |
| `removeAccents()` | N/A | Requires non-null string |
| `isValidDate()` | N/A | Requires non-null string |

---

## Type Signatures

All methods use strict typing (`declare(strict_types=1)`):

```php
public static function removeAccents(string $str): string;
public static function searchWords(?string $words): ?string;
public static function nameFix(#[\SensitiveParameter] ?string $lastName): ?string;
public static function utf8Ansi(?string $value = ''): string;
public static function isValidDate(string $date, string $format = 'Y-m-d H:i:s'): bool;
public static function strReplace(array|string $search, array|string $replace, string $subject): string;
public static function trim(string $string, string $characters = " \t\n\r\0\x0B"): string;
```
Loading
Loading