Install composer require thanhtaivtt/csrf Usages get input token $csrf = new CSRF(); $csrf->tokenField(); check pass token $csrf = new CSRF(); $csrf->validate(); tutorial toidicode.com