How to Create Custom Validation Rule in CodeIgniter 4

Validation rules help to validate the form. You don’t need to write long if statement conditions for every <form > element.

CodeIgnite­r 4 comes equipped with nume­rous pre-defined validation rule­s. However, there­ may be instances where­ you require custom validation rules de­signed specifically for your application’s nee­ds.

In this article, we’ll discuss how to create­ such custom validation rules in CodeIgniter 4. By doing so, you can broade­n the framework’s validation capabilities and maintain data accuracy. Follow the­se steps to seamle­ssly handle distinct and diverse validation sce­narios while extending the­ validating functionality of your web applications alike.

How to create custom validation Rule in CodeIgniter 4

Read more

Add Google reCAPTCHA v2 to form in CodeIgniter 4

Google reCaptcha helps to protect the website against spam and bot submissions. It is mainly applied to login, registration, contact us, and add comment forms.

There are 2 versions of Google reCaptcha –

  1. v2 – User needs to select images based on the question.
  2. v3 – This is an invisible type of captcha.

In this tutorial, I show how you can add google recpatcha v2 to your form with validation in the CodeIgniter 4 project.

Add Google reCAPTCHA v2 to form in CodeIgniter 4

Read more

Step-by-Step Guide: CodeIgniter 4 Adding Foreign Key in Migration

In a database, a foreign key is a field that references another table.

They keep track of related records and which table they exist in. They also let you know what record they relate to, which means updating them is simple and quick.

In this tutorial, I show how you can add a foreign key while creating table using migration in CodeIgniter 4.

Step-by-Step Guide: CodeIgniter 4 Adding Foreign Key in Migration

Read more