There is no license information available for the latest version (0.0.2) of this package.

neoan3 common string operations helper class

0.0.2 2019-06-14 20:33 UTC


Helper library for common tasks. Developed for neoan3, put perfectly usable as stand-alone.

This library facilitates

  • templating
  • string-manipulation


Ops is not a template engine! It is meant to be used for final rendering and string operations. However, Ops can render a template:




$dynamicContent = [
    'user' => 'Test',
    'profile' => [
        'name' => 'John Doe',
echo \Neoan3\Apps\Ops::embraceFromFile('profile.html',$dynamicContent);


<p>John Doe</p>

Main templating methods

embrace($string, $substitutionArray)

Replaces array-keys indicated by double curly braces with the appropriate value

embraceFromFile($fileLocation, $substitutionArray)

Reads content of a file and executes the embrace function.

When using Neoan3, the location starts at the root of your application. As a stand-alone, either define "path" accordingly or use the fallback to the root of the server.

hardEmbrace($string, $substitutionArray)

When working with front-end technology, the similarity of markup can either be wanted (e.g. Vue fills content PHP could not), or ambiguous. You can choose "hardEmbrace" to use double hard brackets instead.


tEmbrace($string, $substitutionArray)

Used for i18n (internationalization) in Neoan3, this method replaces based on t-tags in your markup.

$german = ['hello'=>'hallo'];
$html = '
\Neoan3\Apps\Ops::tEmbrace($html, $german);

Output: <h1>hallo</h1>

String manipulation


Serializes strings, arrays and objects.


Returns a random integer in the requested length.

hash($length = 10, $special = false)

Returns a random string (with or without special characters) in the requested length.

encrypt($string, $key)

Encrypts a string with a symmetric AES-256 algorithm.

decrypt($encrypted, $key)

Encrypts a string with a symmetric AES-256 algorithm.


Returns selected part of $array.

$userInput = [
$clean = Ops::extrude(['id'],$userInput);
// Output $clean: ['id'=>1]


Converts spaces, snake-, kebab- or camelCase to PascalCase


Converts spaces, snake-, kebab- or PascalCase to camelCase


Converts spaces, camel-, kebab- or PascalCase to snake_case


Converts spaces, camel-, snake- or PascalCase to kebab-case