Autonomía digital y tecnológica

Código e ideas para una internet distribuida

Linkoteca. PHP


# Install new PHP 8.3 packages
sudo apt install php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl}# Install FPM OR Apache module
sudo apt install php8.3-fpm
# OR
# sudo apt install libapache2-mod-php8.2# On Apache: Enable PHP 8.3 FPM
sudo a2enconf php8.3-fpm
# When upgrading from an older PHP version:
sudo a2disconf php8.2-fpm## Remove old packages
sudo apt purge php8.2*

You can use the $options array to set the samesite value, for example:

setcookie($name, $value, [
‘expires’ => time() + 86400,
‘path’ => ‘/’,
‘domain’ => ‘domain.com’,
‘secure’ => true,
‘httponly’ => true,
‘samesite’ => ‘None’,
]);

The value of the samesite element should be either None, Lax or Strict.

function slugify($urlString) {
$search = array(‘Ș’, ‘Ț’, ‘ş’, ‘ţ’, ‘Ş’, ‘Ţ’, ‘ș’, ‘ț’, ‘î’, ‘â’, ‘ă’, ‘Î’, ‘ ‘, ‘Ă’, ‘ë’, ‘Ë’);
$replace = array(‘s’, ‘t’, ‘s’, ‘t’, ‘s’, ‘t’, ‘s’, ‘t’, ‘i’, ‘a’, ‘a’, ‘i’, ‘a’, ‘a’, ‘e’, ‘E’);
$str = str_ireplace($search, $replace, strtolower(trim($urlString)));
$str = preg_replace(‘/[^\w\d\-\ ]/’, », $str);
$str = str_replace(‘ ‘, ‘-‘, $str);
return preg_replace(‘/\-{2,}’, ‘-‘, $str);
}

Building a truly international application is not just about translating strings. Other issues to consider are date and time formats, currency symbols and pluralization. Programmers often underestimate the complexity of localization and get stuck with homemade code that is a pain to maintain. So, let’s talk about PHP Arrays, gettext, frameworks, and Intl.

Markdown Extra is an extension to PHP Markdown implementing some features currently not available with the plain Markdown syntax. Markdown Extra is available as a separate parser class in PHP Markdown Lib.