alexskrypnyk/str2name

Convert strings to named formats

1.2.0 2024-05-30 05:11 UTC

This package is auto-updated.

Last update: 2024-08-27 12:23:05 UTC


README

Str2Name logo

Convert strings to named formats

GitHub Issues GitHub Pull Requests Test PHP codecov GitHub release (latest by date) LICENSE Renovate

Generic formatters

Converters between generic formats

Named formatters

Installation and usage

Str2Name is a self-contained class that can be included in any PHP project directly or via Composer. It does not have any dependencies.

There are two ways to include Str2Name in your project:

Direct download

  1. Download the file from the releases page

  2. Register the namespace in composer.json of your project:

{
    "autoload": {
        "psr-4": {
            "AlexSkrypnyk\\Str2Name\\": "path/to/src/Str2Name.php"
        }
    }
}
  1. Use it in your project:
<php

use AlexSkrypnyk\Str2Name\Str2Name;

class MyClass {

    public function myMethod() {
        $string = 'string to convert';
        // Convert string to machine name.
        $string = Str2Name::machine($string);
    }

}

Composer

  1. Require the package via Composer:
 composer require alexskrypnyk/str2name
  1. Use it in your project:
<php

use AlexSkrypnyk\Str2Name\Str2Name;

class MyClass {

    public function myMethod() {
        $string = 'string to convert';
        // Convert string to machine name.
        $string = Str2Name::machine($string);
    }

}

Maintenance

composer install
composer lint
composer test
composer docs

Repository created using https://getscaffold.dev/ project scaffold template