1. Go to this page and download the library: Download stougeiro/schema library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stougeiro / schema example snippets
$schema = new Schema([
'email' => 'string',
'amount' => 'float',
]);
// Structure first
if ( ! $schema->validate($data, $error)) {
return response(422, $error);
}
// Business logic second
$email = EmailService::validate($data['email']);