Download the PHP package mooeypoo/funcystr without Composer
On this page you can find all versions of the php package mooeypoo/funcystr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mooeypoo/funcystr
More information about mooeypoo/funcystr
Files in mooeypoo/funcystr
Package funcystr
Short Description A lightweight PHP library for processing strings with embedded functions.
License MIT
Informations about the package funcystr
FuncyStr Library
FuncyStr is a lightweight JavaScript library designed to process strings with embedded functions. It allows dynamic string resolution based on provided parameters, supporting nested and multiple function calls within a single string.
Features
- Dynamic String Resolution: Replace placeholders in strings with dynamic values based on provided parameters.
- Custom Functions: Define your own functions to handle specific placeholders.
- Nested Functions: Supports resolving functions within other functions.
- Graceful Handling: Leaves unresolved placeholders intact if no matching function is defined.
Monorepo layout
This repository contains both the JavaScript and PHP implementations of funcystr:
-
JavaScript (npm)
- Source:
src/ - Tests:
test/ - Build output:
dist/ - Published as the
funcystrpackage on npm from the repository root.
- Source:
- PHP (Composer / Packagist)
- Source:
php/src/ - Tests:
php/tests/ - Configuration:
composer.jsonat the repository root - Published as the
mooeypoo/funcystrpackage on Packagist from this same repository.
- Source:
Javascript Installation (npm)
Install FuncyStr via npm:
Usage
Basic Example
Nested Functions
Handling Missing Functions
API
new FuncyStr(functions)
Creates a new FuncyStr instance.
functions: An object where keys are function names and values are the corresponding resolver functions.
process(input, params)
Processes a string and resolves all placeholders.
input: The string containing placeholders to resolve.params: An object containing parameters used by the resolver functions.
Testing
Run the test suite to ensure everything is working as expected:
PHP usage (Composer / Packagist)
Install from Packagist:
Basic usage:
Development
JavaScript / npm:
PHP / Composer:
License
This project is licensed under the MIT License by Moriel Schottlender. Credit is appreciated.
If you want to support this project, please feel free to submit pull requests, add issues, or support me by buying me coffee.
