nette/utils
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Nette/Utils is a lightweight PHP utility package that provides a set of useful classes for everyday use in application development. It offers a variety of functions, including string and array manipulation, image handling, safe JSON encoding and decoding, validation, and slug or strong password generation. This composer package enhances efficiency in PHP development by saving from writing common code from scratch.
In order to use the Nette/Utils package, you need to install it using Composer, a tool for dependency management in PHP. You can install the package by running the command composer require nette/utils
in your terminal or command prompt.
Depending on your PHP version, you will need different versions of Nette Utils. For instance:
After successful installation, you can then reference and use the different classes and methods provided by Nette/Utils in your PHP scripts. For example, to use the string utility for generating slugs, you'd do:
<?php
use Nette\Utils\Strings;
$slug = Strings::webalize('Example String');
// output: example-string
To validate an email address, you can use Nette\Utils\Validators:
<?php
use Nette\Utils\Validators;
if (Validators::isEmail('example@email.com')) {
echo 'Valid Email';
} else {
echo 'Invalid Email';
}
Please note that the two code snippets above are just examples on some of the functionalities that Nette Utils provides.
The documentation for Nette/Utils can be found at https://doc.nette.org/utils. This comprehensive resource offers information on everything from installation to usage of the various classes and methods included in the package. It covers topics like array handling, PHP callbacks, manipulation of dates and times, file operations, HTML generation, image processing, JSON encoding/decoding, random string generation, pagination, PHP reflection, string operations, object enhancements, validation, and PHP data types.