1. Go to this page and download the library: Download apdev/lawn-mower 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/ */
use LawnMower\Rule;
class MyRule extends Rule {
protected $error_message = "###FIELD### has my custom error message, with ###PARAMS### too.";
public function isValid():bool {
echo $this->value; //value to be checked
echo $this->params; //array of params passed by constructor
//my stuff goes here
return true; // or false
}
}
...
//get instance of LawnMower\FileUpload::class
$upload = $valid_data['file_upload'];
$upload->isEmpty(); //checks if file is empty
$upload->getPath(); //returns full file path
$upload->getFilename(); //returns filename.ext without path
$stored_file = $upload->store("path/to/file/destination"); //stores file and returns a LawnMower\File::class instance;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.