feat: add slugify by viniciusvts · Pull Request #58 · SSolWEB/string-morpher · GitHub
Skip to content

feat: add slugify - #58

Merged
viniciusvts merged 2 commits into
mainfrom
50-add-slugify
Sep 1, 2026
Merged

feat: add slugify#58
viniciusvts merged 2 commits into
mainfrom
50-add-slugify

Conversation

@viniciusvts

Copy link
Copy Markdown
Member

📝 Description

Add slugify transformer that produces a URL- and file-safe slug. Implementation should chain: normalize (strip accents), to lowercase, replace all non-alnum with separator (default '-'), collapse multiple separators, trim. Effectively: behaves as heritage of toKebabCase, but more strict for slugs/handles. e.g., slugify('Olá mundo, como vai?') => 'ola-mundo-como-vai'.

Closes #50

🎯 Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🔧 Enhancement (improvement of existing feature)
  • 📝 Chore (documentation, refactoring, etc)

✅ Implementation Checklist

Code

  • Transformer created in src/Transformers/ implementing StringTransformerInterface
  • PHPDoc @method added in src/StringMorpher.php
  • PHPDoc @method added in src/Instances/StringMorpherInstance.php

Tests

  • Tests created in tests/Transformers/
  • Tests cover main use cases
  • Tests cover edge cases (null, empty string, etc)
  • All tests pass (vendor/bin/phpunit)

Quality

  • Code passes linter (vendor/bin/phpcs)
  • Code follows project standards

Documentation

  • Method documented in docs/docs/methods/
  • Usage examples included (static and fluent)
  • Parameters and return values documented

Vinicius de Santana and others added 2 commits August 16, 2026 13:21
@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new slugify transformer to the String Morpher library, enabling URL-/file-safe slug generation as a chainable transformation (and via the static facade), with accompanying tests and documentation.

Changes:

  • Introduces SlugifyTransformer implementing StringTransformerInterface to generate strict slugs with configurable separators.
  • Adds slugify PHPDoc @method entries to the StringMorpher facade and StringMorpherInstance for IDE autocomplete.
  • Adds PHPUnit coverage and method documentation for slugify.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Transformers/SlugifyTransformer.php Adds the core slugification transformer logic.
tests/Transformers/SlugifyTransformerTest.php Adds test coverage for transformer + facade usage, including custom/empty separator cases.
src/StringMorpher.php Adds facade PHPDoc @method slugify(...) for discoverability/autocomplete.
src/Instances/StringMorpherInstance.php Adds fluent-instance PHPDoc @method slugify(...) for discoverability/autocomplete.
docs/docs/methods/slugify.md Adds end-user documentation and examples for the new method.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +50 to +60
@viniciusvts
viniciusvts merged commit 42fd49e into main Sep 1, 2026
11 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.

[Feature]: Add slugify transformer (normalized, kebab-case identifier)

2 participants