PHPackages                             weew/helpers-string - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. weew/helpers-string

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

weew/helpers-string
===================

Collection of useful php string helpers.

v1.10.0(9y ago)2158.9k—3.6%19MITPHP

Since Jul 21Pushed 9y ago2 watchersCompare

[ Source](https://github.com/weew/helpers-string)[ Packagist](https://packagist.org/packages/weew/helpers-string)[ RSS](/packages/weew-helpers-string/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (25)Used By (19)

String helpers
==============

[](#string-helpers)

[![Build Status](https://camo.githubusercontent.com/b7e861175bbc2d0f107b910f8020881e681faa2399ae1627dc1d82c60fdd4b75/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f776565772f68656c706572732d737472696e672e737667)](https://travis-ci.org/weew/helpers-string)[![Test Coverage](https://camo.githubusercontent.com/a03ac15f91d4fa1aaa2f31343fa8dbe954ddf37dcd8be2e955f1d53a11d90736/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f776565772f68656c706572732d737472696e672e737667)](https://coveralls.io/github/weew/helpers-string)[![Version](https://camo.githubusercontent.com/6334084399b2f5301f36c410c093ace1048bd050839019d6ff71fb948903066d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776565772f68656c706572732d737472696e672e737667)](https://packagist.org/packages/weew/helpers-string)[![Licence](https://camo.githubusercontent.com/0f0a03c7ebe1802b9403f7070c68608ac91131032d5a5f66048b405dbfa885e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776565772f68656c706572732d737472696e672e737667)](https://packagist.org/packages/weew/helpers-string)

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Introduction](#introduction)
- [Functions](#functions)
    - [s](#s)
    - [str\_starts\_with](#str_starts_with)
    - [str\_ends\_with](#str_ends_with)
    - [url](#url)
    - [path](#path)
    - [get\_type](#get_type)
    - [str\_snake\_case](#str_snake_case)
    - [str\_studly\_caps](#str_studly_caps)
    - [str\_camel\_case](#str_camel_case)
    - [str\_random](#str_random)
    - [str\_explode](#str_explode)
    - [uuid](#uuid)
    - [uuid\_format](#uuid_format)
    - [simple\_uuid](#simple_uuid)
    - [format\_xml](#format_xml)

Installation
------------

[](#installation)

`composer install weew/helpers-string`

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

[](#introduction)

This tiny library provides various helper functions to deal with common string manipulation related problems.

Functions
---------

[](#functions)

#### s

[](#s)

Simple helper to format strings. Supports placeholders like `:key` and `%s`.

`string s(string $format, mixed $args [, mixed $...])`

#### str\_starts\_with

[](#str_starts_with)

Check if a string starts with the given sequence.

`bool str_starts_with(string $string, string $search [, bool $caseSensitive = false])`

#### str\_ends\_with

[](#str_ends_with)

heck if a string ends with the given sequence.

`bool str_ends_with(string $string, string $search [, bool $caseSensitive = false])`

#### url

[](#url)

Combine multiple strings to a url. This function makes sure the pieces are properly glued together with a `/` and eliminates all `//`, except after the protocol.

`string url(string $paths [, $...])`

#### path

[](#path)

Combine multiple strings to a path. Glues pieces together with the proper directory separator and eliminates all `//` or `\\`.

`string path(string $paths [, $...])`

#### get\_type

[](#get_type)

Get type of a value. Returns values like `int`, `string`, `function`. Objects will return its class name.

`string get_type(mixed $abstract)`

#### str\_snake\_case

[](#str_snake_case)

Convert string to snake\_case.

`string str_snake_case(string $string)`

#### str\_studly\_caps

[](#str_studly_caps)

Convert string to StudlyCase.

`string str_studly_caps(string $string [, array $delimiters = ['-', '_']])`

#### str\_camel\_case

[](#str_camel_case)

Convert a string to camelCase.

`string str_camel_case(string $string [, array $delimiters = ['-', '_']])`

#### str\_random

[](#str_random)

Generate a random alphanumeric string. Works only with even numbers.

`string str_random([int $length = 10])`

#### str\_explode

[](#str_explode)

Split a string by one or multiple delimiters. Works the same way as the `explode` function, but allows several delimiters.

`string str_explode(string $string, string|array $delimiter [, int $limit = PHP_INT_MAX])`

#### uuid

[](#uuid)

Generate a v4 uuid.

`string uuid([string $prefix = null, int $length = 36])`

#### uuid\_format

[](#uuid_format)

Format string as a v4 uuid.

`string uuid_format(string $string [, string $prefix = null, int $length = null])`

#### simple\_uuid

[](#simple_uuid)

Generate a uuid of a simpler format.

`string simple_uuid()`

#### format\_xml

[](#format_xml)

Format an xml string.

`string format_xml($string)`

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity73

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~65 days

Total

24

Last Release

3437d ago

Major Versions

v0.0.11 → v1.0.02015-11-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/10b2b854b5829dd13a15967c000ed2119b5faef67aca24d94c653c8ac550d85e?d=identicon)[weew](/maintainers/weew)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/weew-helpers-string/health.svg)

```
[![Health](https://phpackages.com/badges/weew-helpers-string/health.svg)](https://phpackages.com/packages/weew-helpers-string)
```

###  Alternatives

[letudiant/composer-shared-package-plugin

This composer plugin allows you to share selected packages between your projects with symlinks.

16450.9k1](/packages/letudiant-composer-shared-package-plugin)[tpoxa/shortcodes

Wordpress style shorttags support for Yii2

2313.5k](/packages/tpoxa-shortcodes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
