Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 9, 2024 via composer

nette/schema v1.2.5

πŸ“ Nette Schema: validating data structures against a given Schema.
Package summary
Share
2
issues
2
high severity
license
2
1
license
2
(BSD-3-Clause OR GPL-2.0-only OR GPL-3.0-only)
Package created
28 Mar 2019
Version published
5 Oct 2023
Maintainers
1
Total deps
2
Direct deps
1
License
BSD-3-Clause OR GPL-2.0-only OR GPL-3.0-only

Issues

2

2 high severity issues

high
Recommendation: Validate that the license expression complies with your license policy
via: nette/schema@v1.2.5
Recommendation: Validate that the license expression complies with your license policy
via: nette/utils@v4.0.4
Collapse
Expand

Licenses

(BSD-3-Clause OR GPL-2.0-only OR GPL-3.0-only)

Expression
2 Packages, Including:
nette/schema@v1.2.5
nette/utils@v4.0.4
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of nette/schema 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
nette/utilsv4.0.461.98 kB(BSD-3-Clause OR GPL-2.0-only OR GPL-3.0-only)
prod
1

Visualizations

Frequently Asked Questions

What does nette/schema do?

Nette Schema is a pragmatic library specially designed for validation and normalization of data structures against a specific schema. With its intelligent and straightforward API interface, it provides a structured approach to data validation in a PHP environment. It is largely utilized in managing data inputs, such as those received via an API, configuration files, and user-provided data in web forms. This popular PHP Composer package ensures the integrity and accuracy of your data structures, promoting more efficient and less error-prone web applications.

How do you use nette/schema?

To effectively use the Nette Schema, begin by installing the package via Composer using the command composer require nette/schema. Once installed, Nette Schema's functionalities can be harnessed by creating validation schemas using the Nette\Schema\Expect class. Data structures are then processed against these schemas using the Nette\Schema\Processor class. For instance:

$processor = new Nette\Schema\Processor;
$schema = Expect::structure([
	'processRefund' => Expect::bool(),
	'refundAmount' => Expect::int(),
]);
$data = [
	'processRefund' => true,
	'refundAmount' => 17,
];
try {
	$normalized = $processor->process($schema, $data);
} catch (Nette\Schema\ValidationException $e) {
	echo 'Data is invalid: ' . $e->getMessage();
}

In this example, the $schema defines the required data structure. The processor then attempts to normalize the $data against the $schema. If the $data does not fit the structure defined in $schema, a ValidationException gets thrown.

Where are the nette/schema docs?

For comprehensive understanding and detailed explanation of the different functionalities and usage of Nette Schema, refer to the official documentation on the Nette website at https://doc.nette.org/schema. This documentation provides an extensive, yet easy-to-understand, guide to effectively using Nette Schema. It includes clear examples, making the package more approachable for beginners and professionals alike, contributing to its increased usage in data validation and normalization.