PHP code example of sharkzt / helpersbundle

1. Go to this page and download the library: Download sharkzt/helpersbundle 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/ */

    

sharkzt / helpersbundle example snippets

 php

// Feel free to use as service like $validationHelper = $this->get('sharkzt_helpers.validation_helper');
$id = 111;
$email = "test@mail";
$validationHelper = new ValidationHelper(new ErrorHelper());
$validationHelper->setParameter([$id, $validationHelper->integer])
                 ->setParameter([$id, new Choice([1, 2, 3])])
                 ->setParameter([$email, new Email()]);
                 
if (!$validationHelper->validate()) {
    return $this->view($validationHelper->getResponse());
}
 php

//Set up your service $purifierHelper = $this->get('sharkzt_helpers.purifier_helper');
$purifierHelper = new PurifierHelper();
$purifier = $purifierHelper->initialize();
$xssCode = "<script>alert('Xss');</script>Hello world!"

//Purify your variable, to avoid any html code in
$pureString = $purifier->purify($xssCode);