Download the PHP package mf/stringify without Composer
On this page you can find all versions of the php package mf/stringify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor mf
Package stringify
Short Description Simple and tiny class (function) to stringify anything in PHP.
License MIT
Package stringify
Short Description Simple and tiny class (function) to stringify anything in PHP.
License MIT
Please rate this library. Is it a good library?
Informations about the package stringify
Stringify
Simple and tiny class (function) to stringify anything in PHP.
Installation
Usage
By class and static method
By standalone function
Sprintf bonus
with a new
%A
placeholder forstringify
function
Example
NOTE: values longer than 100 chars is shrinked to 100 chars with ...
suffix
For easier examples, let's use a standalone function
Type | PHP | Result (string) |
---|---|---|
NULL | stringify(null); |
null |
bool | stringify(true); |
true |
bool | stringify(false); |
false |
string | stringify(''); |
"" |
string | stringify('Some string'); |
"Some string" |
int | stringify(42); |
42 |
float | stringify(3.14); |
3.14 |
array | stringify([1, 2, 3]); |
[1, 2, 3] |
array | stringify(['foo' => 'bar']); |
["foo" => "bar"] |
array | stringify(['person' => ['name' => 'Peter Parker'], 'alterego' => 'spider-man']); |
["person" => ["name" => "Peter Parker"], "alterego" => "spider-man"] |
object | stringify(new \Foo\Bar()); |
Foo\Bar |
object | stringify(new \DateTime()); |
DateTime { 2018-11-15T10:20:30+00:00 } |
object | stringify(Seq::range('1..4')); |
MF\Collection\Immutable\Seq [1, 2, 3, 4] |
Changelog
For latest changes see Semantic Versioning.
Contributing and development
Install dependencies
Run tests
For each pull-request, unit tests as well as static analysis and codestyle checks must pass.
To run all those checks execute:
All versions of stringify with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
The package mf/stringify contains the following files
Loading the files please wait ....