Download the PHP package hatchyu/string-utils without Composer

On this page you can find all versions of the php package hatchyu/string-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package string-utils

Hatchyu String Utils

A powerful PHP string manipulation library for smarter slugging, casing, and monotonic unique hash generation.

The main goal of this package is to improve code-like and identifier-like strings that Laravel's default Str::slug() tends to flatten too aggressively. It handles camelCase, StudlyCase, acronym boundaries, number-to-word transitions, Unicode transliteration, and optional compound-word protection.

Features

Installation

Requirements

Without ext-intl, the slug helpers still work, but transliteration depends only on the raw input that PHP receives.

Usage

StrTo Helpers

Slugging helpers

Casing helpers

Compound Words

Some business or technical terms are better kept intact instead of being split by the generic regex rules. For that, you can register compound words once:

This is useful when your SEO slugs need to reflect business or domain vocabulary more precisely than generic splitting rules can infer on their own.

Important note:

To clear the configured list:

Laravel Comparison

The table below compares Laravel's default Str::slug() behavior with the default StrTo::slug() behavior, without any configured compound words.

Seed Laravel Str::slug() Hatchyu StrTo::slug()
DBSettings dbsettings db-settings
hasConsecutiveCAPS hasconsecutivecaps has-consecutive-caps
NewHDDModule newhddmodule new-hdd-module
apiV2Endpoint apiv2endpoint api-v2-endpoint
usingSHA256Hashing usingsha256hashing using-sha256-hashing
Version2API version2api version2-api
XMLHttpRequest2Handler xmlhttprequest2handler xml-http-request2-handler
IPv6Address ipv6address ipv6-address
parseURL2HTML parseurl2html parse-url2-html
JSON2XMLConverter json2xmlconverter json2-xml-converter
userID42Profile userid42profile user-id42-profile
MySQL8Adapter mysql8adapter my-sql8-adapter
SimpleXMLParser simplexmlparser simple-xml-parser
CSS3Parser css3parser css3-parser
admin/ModuleName/File.php adminmodulenamefilephp admin-module-name-file-php
WebERP weberp web-erp
HDDCapacity hddcapacity hdd-capacity
testUPPERIsOKNow testupperisoknow test-upper-is-ok-now
2GB RAMWillBe 2gb ram 2gb-ramwillbe-2gb-ram 2-gb-ram-will-be-2-gb-ram
123number and number123 small 123number-and-number123-small 123-number-and-number123-small
FirstCaps and lastcapYes firstcaps-and-lastcapyes first-caps-and-lastcap-yes
CreatedAt createdat created-at
Τάχιστη αλώπηξ βαφής ψημένη γη, takhisti-alwpiks-vafis-psimeni-ghi tachiste-alopex-baphes-psemene-ge
δρασκελίζει υπέρ νωθρού κυνός draskelizei-iper-nothrou-kinos draskelizei-yper-nothrou-kynos
Τάχιστη Αλώπηξ Βαφήσ Ψημένη Γη, takhisti-alwpiks-bafis-psimeni-gi tachiste-alopex-baphes-psemene-ge
Δρασκελίζει Υπέρ Νωθρού Κυνόσ draskelizei-yper-nothrou-kinos draskelizei-yper-nothrou-kynos
more...Dots.... yes. moredots-yes more-dots-yes
ഇതിന് മലയാളം പരിഭാഷപ്പെടുത്താനും കഴിയും itin-malayalam-paribhasappetuttanum-kaliyum
यह हिंदी का अनुवाद भी कर सकता है yaha-hatha-ka-anavatha-bha-kara-sakata-ha yaha-hindi-ka-anuvada-bhi-kara-sakata-hai
இது தமிழையும் மொழிபெயர்க்கலாம் itu-tamilaiyum-molipeyarkkalam
ఇది తెలుగును కూడా అనువదించగలదు idi-telugunu-kuda-anuvadincagaladu
ಇದು ಕನ್ನಡವನ್ನೂ ಅನುವಾದಿಸಬಹುದು idu-kannadavannu-anuvadisabahudu
هذا يمكن أيضا أن يترجم العربية htha-ymkn-ayda-an-ytrgm-alaarby hdha-ymkn-ayda-an-ytrjm-al-rbyt
这个也可以翻译成中文 zhe-ge-ye-ke-yi-fan-yi-cheng-zhong-wen
これは日本語も翻訳できます koreha-ri-ben-yumo-fan-yidekimasu
[email protected] rajesh-at-examplecom rajesh-at-example-com

Default Slug vs Compound-Word-Aware Slug

The generic slug rules already improve many technical strings, but they cannot always infer business-specific or brand-specific tokens perfectly. When you explicitly register compound words, the slug can become even more intentional.

Examples:

Seed Default StrTo::slug() With setCompoundWords(...)
B2BLeadAPI b2-blead-api b2b-lead-api
MySQL8Adapter my-sql8-adapter mysql8-adapter
GraphQL API graph-ql-api graphql-api
YouTube APIClient you-tube-api-client youtube-api-client
i18nConfig i18-n-config i18n-config
iPhoneCase i-phone-case iphone-case

The important idea is not that every string needs configured compounds. The default behavior should stay generic. Compound words are there when your business vocabulary deserves better-than-generic splitting.

Hash Helper

License

MIT


All versions of string-utils with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hatchyu/string-utils contains the following files

Loading the files please wait ...