Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 51 | All time: 10,692 This week: 206![]() |
Version | License | PHP version | Categories | |||
mezon-security 1.0 | MIT/X Consortium ... | 5 | PHP 5, Graphics, Files and Folders, V... |
Description | Author | |
This package can validate uploaded files using multiple rules. |
|
Mezon provides set of classes wich will help you to validate data from front-end
Just print in console
composer require mezon/security
And that's all )
First of all you need to create validator for the file size:
use \Mezon\Security;
// here we set that file must not be greater then 2KB
$sizeValidator = new Validators\File\Size(2 * Validators\File\Size::KB);
Then you can run validation
$security = new SecurityRules();
$security->isUploadedFileValid('uploaded-file', $validators);
Here 'uploaded-file' is an index in the $_FILES array.
You can validate mime types of the uploading files. To do this construct special validator and pass a list of valid mime types to it's constructor
// here we set that file must not be greater then 2KB
$sizeValidator = new Validators\File\MymeType(['image/png', 'image/jpeg', 'image/jpg']);
And then call isUploadedFileValid like in the example above.
You can use validators for the image size:
new Mezon\Security\Validators\File\ImageMaximumWidthHeight(<maximum width>, <maximum height>);
// and
new Mezon\Security\Validators\File\ImageMinimumWidthHeight(<minimum width>, <minimum height>);
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation | ||
![]() |
Class | Class source | ||
![]() |
Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.