PHP code example of hatchyu / string-utils

1. Go to this page and download the library: Download hatchyu/string-utils library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hatchyu / string-utils example snippets


use Hatchyu\String\StrTo;

echo StrTo::slug('DBSettings');         // db-settings
echo StrTo::slug('[email protected]'); // rajesh-at-example-com
echo StrTo::headline('DBSettings');     // DB Settings

StrTo::slug('apiV10Endpoint');              // api-v10-endpoint
StrTo::snake('apiV10Endpoint');             // api_v10_endpoint
StrTo::kebab('apiV10Endpoint');             // api-v10-endpoint
StrTo::dotted('moduleDirectory/FileName');  // module.directory.file.name
StrTo::dotPath('moduleDirectory/FileName'); // module-directory.file-name

StrTo::title('hatchyu API EndPoint');    // Hatchyu Api End Point
StrTo::words('hatchyu API EndPoint');    // Hatchyu API End Point
StrTo::headline('hatchyu API EndPoint'); // Hatchyu API End Point
StrTo::studly('hatchyu API EndPoint');   // HatchyuApiEndPoint
StrTo::camel('hatchyu API EndPoint');    // hatchyuApiEndPoint
StrTo::upper('hatchyu API EndPoint');    // HATCHYU API ENDPOINT
StrTo::lower('hatchyu API EndPoint');    // hatchyu api endpoint
StrTo::ucfirst('hatchyu API EndPoint');  // Hatchyu API EndPoint
StrTo::lcfirst('hatchyu API EndPoint');  // hatchyu API EndPoint

use Hatchyu\String\StrTo;

StrTo::setCompoundWords(['B2B', 'MySQL', 'OAuth2', 'IPv6', 'i18n', 'GraphQL', 'YouTube', 'macOS', 'iPhone']);

StrTo::slug('B2BLeadAPI');        // b2b-lead-api
StrTo::slug('MySQL8Adapter');     // mysql8-adapter
StrTo::slug('OAuth2CallbackURL'); // oauth2-callback-url
StrTo::slug('IPv6Address');       // ipv6-address
StrTo::slug('i18nConfig');        // i18n-config
StrTo::slug('GraphQLAPI');        // graphql-api
StrTo::slug('YouTubeAPIClient');  // youtube-api-client
StrTo::slug('macOSConfig');       // macos-config
StrTo::slug('iPhoneCase');        // iphone-case

StrTo::setCompoundWords([]);

StrTo::setCompoundWords(['B2B', 'MySQL', 'i18n', 'GraphQL', 'YouTube', 'iPhone']);

use Hatchyu\String\Hash;

echo Hash::uniqueHash(40);