hapheus/laravel-text-spinner

A Laravel package to spin text.

dev-master 2022-02-11 06:02 UTC

This package is auto-updated.

Last update: 2024-11-11 11:44:17 UTC


README

build PHP Composer PHP Code Sniffer PHP Unit Tests

Packagist GitHub last commit

Install

Using composer

composer require hapheus/laravel-text-spinner

Features

Spin's a set of nested strings into plain text.

Example: "Foo{Bar|Foo}" returns "FooBar" or "FooFoo".

Usage

1. Using Class

$text = '{Ehlo|Hello|Howdy} {World|Earth|You}{!|?|.}';
$textSpinner = new HAF\TextSpinner\TextSpinner();
$spinnedText = $textSpinner->spin();

2. Using Laravel Facade

$text = '{Ehlo|Hello|Howdy} {World|Earth|You}{!|?|.}';
$spinnedText = app('text-spinner')->spin($text);
$spinnedText = App::make('text-spinner')->spin($text);
$spinnedText = TextSpinner::spin($text);

Code Quality

PHP Code Sniffer PHP Unit Tests

composer test
composer check-style