Tag: PHP

Install and Use Composer Safely on Debian 10 (Step-by-Step)

Install and Use Composer Safely on Debian 10 (Step-by-Step)

If you’re trying to install some PHP tool and it keeps saying “run this with Composer”, but your Debian 10 server just shrugs, this one’s for you. Before: you copy-paste commands from a GitHub README, get a Composer error, and nothing works. After: Composer is installed, verified, and you can install PHP packages and frameworks without guessing. This guide is…

Read More »

PHP function to cut string into a specific length

PHP function to cut string into a specific length. Very useful for “Read More” links. function wCut($str, $maxLength = 40) { $strToCount = html_entity_decode($str); if (strlen($strToCount) <= $maxLength) { return $str; } $s2 = substr($strToCount, 0, $maxLength – 3); $s2 .= “…”; return htmlentities($s2); } $str = ‘Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nunc risus, euismod ac,…

Read More »