PHP code example of webandcow / cakephp-sanitize

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

    

webandcow / cakephp-sanitize example snippets


class User extends AppModel {

    public $actsAs = [
		'Sanitize' => [
			'fields' => [
				'nom' => 'stripHtml', 
				'prenom' => 'stripHtml', 
				'username' => 'stripHtml', 
			]
        ]
    ];

}

class User extends AppModel {

    public $actsAs = [
		'Sanitize' => [
			'fields' => '*',
			'exclude' => ['password', 'age'], 
			'map' => [
				'string' => 'stripHtml',
				'text' => 'stripHtml'
			]
        ]
    ];

}