Download the PHP package 86dev/php-tools without Composer
On this page you can find all versions of the php package 86dev/php-tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-tools
php-tools
A set of tools for PHP
Boolean
The BoolHelper
class provides static functions to parse a human boolean string to a boolean.
- Already boolean value will be returned as is.
- All non zero numeric value will return true.
- Null and 0 will return false.
- Strings like "yes", "true" and "1" will return true. (case insensitive)
- Strings like "no", "false" and "0" will return false. (case insensitive)
-
International values of this strings are available:
- true strings: ae, ano, asli, bai, benetako, bəli, bẹẹni, da, dhabta ah, e, ea sebele, echt, ee, eh, eny, evet, ezigbo, fíor, gerçek, gidi, go iawn, ha, haa, halisi, haqiqiy, ie, igen, inde, iva, iya nih, ja, jah, joo, já, jā, ndiyo, nekilnojamasis, nuhun, nyata, oo, oui, po, pravi, prawdziwy, real, reali, reyèl, reāls, sebenar, si, sim, skutečný, skutočný, sì, sí, taip, tak, tena, thực, tinuod nga, true, tá, tõeline, tūturu, valódi, vero, vrai, vâng, weniweni, werklike, wi, ya, yebo, yes, áno, ναί, πραγματικός, да, бодит, вистински, воқеӣ, да, ды, иә, прави, реален, реальний, реальный, рэальны, так, тийм ээ, шын, ҳа, այո, իրական, אמיתי, כן, פאַקטיש, اصلی, بله, جی ہاں, حقيقي, نعم فعلا, واقعی, असली, रिअल, वास्तविक, हाँ, हो, होय, বাস্তব, হাঁ, ਅਸਲੀ, ਹਾਂ, વાસ્તવિક, હા, ஆம், உண்மையான, అవును, నిజమైన, ನಿಜವಾದ, ಹೌದು, അതെ, യഥാർത്ഥ, ඔව්, සැබෑ, จริง, ใช่, ທີ່ແທ້ຈິງ, ແມ່ນແລ້ວ, စစ်မှန်သော, ဟုတ်ကဲ့, დიახ, რეალური, បាទ, ពិតប្រាកដ, はい, リアル, 实, 實, 是, 예, 현실
- false strings: amanga, ayi, babu, bakak, been ah, bohata, br, bréagach, cha, che, dili, dim, diso, ee e, ei, eke, fals, falsch, false, falsk, falso, faltsua, falz, faux, fałszywy, ffug, fo, geen, hamis, hapana, hindi, huwad, ingen, jo, không, klaidinga, lažan, lažno, le, maya, napačen, ne, nee, nei, nein, nej, nem, nepravdivé, nepravdivý, nie, no, non, noto'g'ri, nr, nu, nē, onwaar, ora, pa gen okenn, palsu, rangt, rara, sai, salah, teka, teu, tidak, tsy misy, uimh, uongo, vale, vals, viltus, väärä, yanlış, yo'q, yok hayır, yox, zabodza, št, žiadny, ƙarya, ψευδής, όχι, не, бр, жалған, жоқ, лажно, ложный, не, немає, нет, неточно, нодуруст, няма, помилковий, фалшив, фальшывы, худал, үгүй, կեղծ, ոչ, לא, שֶׁקֶר, خاطئة, غلط, لا, نادرست, نه, نہیں, असत्य, खोटे, गलत, नहीं, नाही, না, মিথ্যা, ਝੂਠ, ਨਹੀਂ, ખોટા, ના, இல்லை, தவறான, ఏ, తప్పుడు, ಇಲ್ಲ, ಸುಳ್ಳು, ഇല്ല, തെറ്റായ, අසත්යය, නැත, เท็จ, ไม่, ບໍ່ຖືກຕ້ອງ, မမှန်သော, အဘယ်သူမျှမ, არა, ყალბი, ទេ, មិនពិត, ụgha, 假, 偽, 沒有, 没有, 그릇된, 아니
Note: This is done via google and can be wrong, please fill an issue if you find an error in your language. Also
mb_strtolower
is called prior to checking the value. It works well in almost every language but not in some others:mb_strtoupper('yanlış') === 'YANLIŞ'
(notice the absence of dot on the i) but converted back to lowercase it gives'yanliş'
(this time with a dot on the i)
Use case
Strings
The StringHelper
class provides static functions to convert string to different developper casing.
It also provides a remove_diacritics
function (used by the functions above) to remove diacritics (é, è, à, â, ç, ...).
Debug
The Debug
class provides function to handle error display.
dumpit($value)
usevar_export
to print the $value content in a <pre> tag.dumpitscript($value)
usejson_encode
to print the $value content in the javascript console.reportit
does the same asdumpit
but returns the string instead of printing it.reportitscript
does the same asdumpitscript
but returns the string instead of printing it.exception_to_array($exception, $max_recursion = 5)
transforms the exception to an array. It will recursively call itself if the given $exception has a previous exception and $max_recursion is greater than 0.
ServerArray
Tired of checking online what are the correct keys for the $_SERVER array ? The ServerArray
class provides access to all standard $_SERVER keys.
https://www.php.net/manual/en/reserved.variables.server
HtmlCodes
As the ServerArray
, the HtmlCodes
class provides a list of html codes constants.
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Timer
The Timer
class is a simple class to analyze execution time
Timers
You can record multiple times with Timers
.
Monolog\TimerProcessor
The Monolog\TimerProcessor
class add a duration in seconds with milliseconds to the extra array when using monolog/monolog package.
Monolog\RequestIdProcessor
The Monolog\RequestIdProcessor
class add a request id to the extra array when using monolog/monolog package.
The id is a hash made of $_SERVER['REMOTE_ADDR'].$_SERVER['REMOTE_PORT'].$_SERVER['REQUEST_TIME_FLOAT'].$_SERVER['REQUEST_URI']
The goal is to provide a way to distinguish logged message by different simultaneous requests.