bfg/text

All sorts of chips to work with the text

Maintainers

Details

github.com/bfg-s/text

Source

Issues

Installs: 20 648

Dependents: 4

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:bfg-app

0.0.4 2023-05-22 14:55 UTC

This package is auto-updated.

Last update: 2024-10-22 18:10:28 UTC


README

Helpers

is_json

Checks whether the row is Json object.

is_json(json_encode(['test' => true])); 
// true

lang_in_text

Applies special triggers of language variables.

lang_in_text("Text: @validation.accepted"); 
// Text: The :attribute must be accepted.

tag_replace

Invested tag replacement on the object values or array.

tag_replace("Hello, {user.name} {user.lastname}. You phone: {phone}", [
    'user' => ['name' => 'Ivan', 'lastname' => 'Petrov'],
    'phone' => '123456789'
]); 
// Hello, Ivan Petrov. You phone: 123456789

file_lines_get_contents

Get data from file by lines.

file_lines_get_contents('LICENSE.md', 3, 3); 
//Copyright (c) 2021 BFG <bfg.script@gmail.com>