Download the PHP package vielhuber/stringhelper without Composer

On this page you can find all versions of the php package vielhuber/stringhelper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package stringhelper

build status

⛏️ stringhelper ⛏️

motivation

this package is a collection of various helpers for string manipulation, validation, and utility functions designed to simplify the life of php developers. it streamlines tasks like checking variable existence, comparing values, and handling dates, urls, and emails. this tool enhances efficiency by offering concise, reusable methods for everyday coding challenges.

installation

usage

existence

equality

value

loop

try

A short note on the usage of @: In this concept we use @-operator that hides errors. We are aware of its potential misuse and also of its benefits.

Be careful when using @\$a['undefined'], there can be 2 possible errors: a missing variable or a missing index. In both cases, we intentionally prevent the parser from stopping and catch the resulting null value. Be aware: If $a is a string, @\$a['undefined'] evaluates to $a[0] since php coerces 'undefined' to 0 and therefore exists.

Another general rule of thumb: Don't use the operator before function calls (@__x(\$a['undefined']).

A caveat is that the @-operator does not catch any fatal runtime errors since PHP 8 anymore.\ For that there is also another more sophisticated way of checking the existence of variables:

If $var is totally undefined, the following expressions evaluate correctly to false:

Be aware that arrow functions are only available from php 7.4; Prior versions should use:

classes

helpers

there are also some other neat little helpers available.

usage as class

if you don't like hotloaded functions, you also can use this library in a class-based way:

js implementation

there is also a javascript implemenation hlp with similiar functions available.

testing

copy .env.example to .env, fill in values, install dependencies with composer install and run ./vendor/bin/phpunit.

appendix

existence matrix

__x() __true() __false() !== null != null !== false != false === true == true !is_null() isset() !empty() if/else ?true:false (??true) === true (??true) == true (??true) === false (??true) == false count() > 0 != '' !== ''
null false false false false false true false false false false false false false false true true false false false false true
false false false true true false false false false false true true false false false false false true true true false true
true true true false true true true true true true true true true true true true true false false true true true
[] false false false true false true false false false true true false false false false false false false false true true
[''] false false false true true true true false true true true true true true false true false false true true true
0 true false true true false true false false false true true false false false false false false false true false true
1 true true false true true true true false true true true true true true false true false false true true true
-1 true true false true true true true false true true true true true true false true false false true true true
'0' true false true true true true false false false true true false false false false false false false true true true
'1' true true false true true true true false true true true true true true false true false false true true true
'-1' true true false true true true true false true true true true true true false true false false true true true
'' false false false true false true false false false true true false false false false false false false true false false
' ' false false false true true true true false true true true true true true false true false false true true true
'null' true false false true true true true false true true true true true true false true false false true true true
'false' true false true true true true true false true true true true true true false true false false true true true
'true' true true false true true true true false true true true true true true false true false false true true true
'str' true true false true true true true false true true true true true true false true false false true true true
[0,1] true true false true true true true false true true true true true true false true false false true true true
[0] true true false true true true true false true true true true true true false true false false true true true
'a:0:{}' false false false true true true true false true true true true true true false true false false true true true
'b:1;' true true false true true true true false true true true true true true false true false false true true true
'b:0;' false false true true true true true false true true true true true true false true false false true true true
new stdClass false false false true true true true false true true true true true true false true false false true true true
$_GET['undefined'] error error error error error error error error error error false false error error false true false false error error error
sub>@$\_GET['undefined'] false false false false false true false false false false false false false false true true false false false false true

loose comparison matrix

== null false true [] [''] 0 1 -1 '0' '1' '-1' '' ' ' 'null' 'false' 'true' 'str' [0,1] [0] 'a:0:{}' 'b:1;' 'b:0;' new stdClass \$_GET['undefined'] sub>@\$\_GET['undefined']
null true true false true false true false false false false false true false false false false false false false false false false false error true
false true true false true false true false false true false false true false false false false false false false false false false false error true
true false false true false true false true true false true true false true true true true true true true true true true true error false
[] true true false true false false false false false false false false false false false false false false false false false false false error true
[''] false false true false true false false false false false false false false false false false false false true false false false false error false
0 true true false false false true false false true false false true true true true true true false false true true true error error true
1 false false true false false false true false false true false false false false false false false false false false false false error error false
-1 false false true false false false false true false false true false false false false false false false false false false false error error false
'0' false true false false false true false false true false false false false false false false false false false false false false false error false
'1' false false true false false false true false false true false false false false false false false false false false false false false error false
'-1' false false true false false false false true false false true false false false false false false false false false false false false error false
'' true true false false false true false false false false false true false false false false false false false false false false false error true
' ' false false true false false true false false false false false false true false false false false false false false false false false error false
'null' false false true false false true false false false false false false false true false false false false false false false false false error false
'false' false false true false false true false false false false false false false false true false false false false false false false false error false
'true' false false true false false true false false false false false false false false false true false false false false false false false error false
'str' false false true false false true false false false false false false false false false false true false false false false false false error false
[0,1] false false true false false false false false false false false false false false false false false true false false false false false error false
[0] false false true false true false false false false false false false false false false false false false true false false false false error false
'a:0:{}' false false true false false true false false false false false false false false false false false false false true false false false error false
'b:1;' false false true false false true false false false false false false false false false false false false false false true false false error false
'b:0;' false false true false false true false false false false false false false false false false false false false false false true false error false
new stdClass false false true false false error error error false false false false false false false false false false false false false false true error false
\$_GET['undefined'] error error error error error error error error error error error error error error error error error error error error error error error error error
sub>@\$\_GET['undefined'] true true false true false true false false false false false true false false false false false false false false false false false error true

All versions of stringhelper with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vielhuber/stringhelper contains the following files

Loading the files please wait ....