{"id":22300422,"url":"https://github.com/mailboxvalidator/mailboxvalidator-codeigniter4","last_synced_at":"2025-10-07T17:58:43.671Z","repository":{"id":143961656,"uuid":"327784682","full_name":"MailboxValidator/mailboxvalidator-codeigniter4","owner":"MailboxValidator","description":"MailboxValidator CodeIgniter4 library enable users to block disposal email, detect free email and validate if an email is valid","archived":false,"fork":false,"pushed_at":"2025-07-04T00:55:02.000Z","size":26,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-29T02:47:52.088Z","etag":null,"topics":["codeigniter","codeigniter-library","codeigniter4","email-checker","email-validation","email-validator","email-verification"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MailboxValidator.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-08T03:06:00.000Z","updated_at":"2025-07-04T00:55:05.000Z","dependencies_parsed_at":"2024-12-03T18:10:57.582Z","dependency_job_id":"765988f2-b172-43f1-a344-06097142aedc","html_url":"https://github.com/MailboxValidator/mailboxvalidator-codeigniter4","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MailboxValidator/mailboxvalidator-codeigniter4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MailboxValidator","download_url":"https://codeload.github.com/MailboxValidator/mailboxvalidator-codeigniter4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MailboxValidator%2Fmailboxvalidator-codeigniter4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278820492,"owners_count":26051766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeigniter","codeigniter-library","codeigniter4","email-checker","email-validation","email-validator","email-verification"],"created_at":"2024-12-03T18:10:53.778Z","updated_at":"2025-10-07T17:58:43.651Z","avatar_url":"https://github.com/MailboxValidator.png","language":"PHP","readme":"# MailboxValidator CodeIgniter 4 Email Validation Package\n\nMailboxValidator CodeIgniter 4 Email Validation Package enables user to easily validate if an email address is valid, a type of disposable email or free email.\n\nThis package can be useful in many types of projects, for example\n\n - to validate an user's email during sign up\n - to clean your mailing list prior to email sending\n - to perform fraud check\n - and so on\n\n*Tested up to CodeIgniter 4.6.1 and PHP 8.4.*\n\n\n## Installation\n\nUpload the ``Libraries`` folder to your CodeIgniter ``app`` folder\n\n\n\n## Dependencies\n\nThis package will only work with CodeIgniter 4. For CodeIgniter 3, you can get it from [here](https://github.com/MailboxValidator/mailboxvalidator-codeigniter).\n\nAn API key is required for this module to function.\n\nGo to https://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you'll be given an API key.\n\nAfter you get your API key, you can set you API key in controller during calling library. For example:\n```php\nuse App\\Libraries\\Mailboxvalidator;\n$params = array('mbv_api_key' =\u003e 'PASTE_YOUR_API_KEY_HERE');\n$mbv = new Mailboxvalidator($params);\n```\n\n\n\n## Functions\n\n### getSingleResult (email_address)\n\nPerforms email validation on the supplied email address.\n\n#### Return Fields\n\n| Field Name | Description |\n|-----------|------------|\n| email_address | The input email address. |\n| domain | The domain of the email address. |\n| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: True, False |\n| is_syntax | Whether the email address is syntactically correct. Return values: True, False |\n| is_domain | Whether the email address has a valid MX record in its DNS entries. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_smtp | Whether the mail servers specified in the MX records are responding to connections. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_verified | Whether the mail server confirms that the email address actually exist. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_server_down | Whether the mail server is currently down or unresponsive. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_greylisted | Whether the mail server employs greylisting where an email has to be sent a second time at a later time. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_suppressed | Whether the email address is in our blacklist. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_role | Whether the email address is a role-based email address like admin@example.net or webmaster@example.net. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_high_risk | Whether the email address contains high risk keywords. Return values: True, False, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| is_catchall | Whether the email address is a catch-all address. Return values: True, False, Unknown, -\u0026nbsp;\u0026nbsp;\u0026nbsp;(- means not applicable) |\n| mailboxvalidator_score | Email address reputation score. Score \u003e 0.70 means good; score \u003e 0.40 means fair; score \u003c= 0.40 means poor. |\n| time_taken | The time taken to get the results in seconds. |\n| status | Whether our system think the email address is valid based on all the previous fields. Return values: True, False |\n| credits_available | The number of credits left to perform validations. |\n| error_code | The error code if there is any error. See error table in the below section. |\n| error_message | The error message if there is any error. See error table in the below section. |\n\n\n\n#### isDisposableEmail (email_address)\n\nCheck whether the email address is belongs to a disposable email provider or not. Return Values: True, False\n\n\n\n#### isFreeEmail (email_address)\n\nCheck whether the email address is belongs to a free email provider or not. Return Values: True, False\n\n\n\n## Usage\n\n### Form Validation\n\nTo use this library in form validation, first create a new file under ``app/Libraries`` called ``FormValidation.php``.\n\nAfter that, copy the following sample code into ``FormValidation.php``:\n```php\n\u003c?php namespace App\\Libraries;\n\nuse App\\Libraries\\Mailboxvalidator;\n\nclass FormValidation\n{\n    public function disposable($email, string \u0026$error = null): bool\n    {\n        $params = array('mbv_api_key' =\u003e 'PASTE_YOUR_API_KEY_HERE');\n        $$mbv = new Mailboxvalidator($params);\n        if ($$mbv-\u003eisDisposableEmail($email) === true) {\n            // If is_email_disposable return true, means the email is disposable email\n            $error = 'A disposable email address is detected.';\n            return false;\n        } else {\n            return true;\n        }\n    }\n\n    public function free($email, string \u0026$error = null): bool\n    {\n        $params = array('mbv_api_key' =\u003e 'PASTE_YOUR_API_KEY_HERE');\n        $$mbv = new Mailboxvalidator($params);\n        if ($$mbv-\u003eisFreeEmail($email) === true) {\n            // If is_email_free return true, means the email is free email\n            $error = 'A free email address is detected.';\n            return false;\n        } else {\n            return true;\n        }\n    }\n}\n```\n\nAfter that, open your ``app\\Config\\Validation.php`` file, and add the below line into the ``$ruleSets`` array:\n\n```php\n        \\App\\Libraries\\FormValidation::class,\n```\n\n\n\nNext, in your form controller, you can use the function from ``FormValidation.php`` to validate email. For example, if you want to use the ``disposable`` function to validate email, you can follow sample code as shown in below:\n\n```php\n\u003c?php namespace App\\Controllers;\n\nuse CodeIgniter\\Controller;\n\nclass Form extends Controller\n{\n    public function index()\n    {\n        helper(['form', 'url']);\n        $validation =  \\Config\\Services::validation();\n        echo view('Signup');\n    }\n    public function submit()\n    {\n        helper(['form', 'url']);\n\n        if (! $this-\u003evalidate([\n            'username' =\u003e 'required',\n            'email' =\u003e 'disposable',\n        ]))\n        {\n            echo view('Signup-error', [\n                'validation' =\u003e $this-\u003evalidator\n            ]);\n        }\n        else\n        {\n            echo view('Success');\n        }\n    }\n}\n```\n\nNoted that you will be required to add a custom error message for it. Now you can open your form and try to enter a disposable email address to see the outcome. The form should return the error message for the disposable email.\n\n### Email Validation\n\nTo use this library to get validation result for an email address, firstly load the library in your controller like this:\n```php\nuse App\\Libraries\\Mailboxvalidator;\n```\nNext, in your controller function, load your MailboxValidator API key like this:\n\n```php\n$params = array('mbv_api_key' =\u003e 'PASTE_YOUR_API_KEY_HERE');\n$mbv = new Mailboxvalidator($params);\n```\n\nAfter that, you can get the validation result for the email address like this:\n\n```php\n$result = $mbv-\u003egetSingleResult('test@example.com');\n```\nTo pass the result to the view, just simply add the $result to your view loader like this:\n```php\necho view('result', $result);\n```\nAnd then in your view file, call the validation results. For example:\n```php\n\u003c?= esc($email_address) ?\u003e\n\u003c?= esc($mailboxvalidator_score) ?\u003e\n\u003c?= boolval($status) ? 'Yes' : 'No' ?\u003e\n```\nYou can refer the full list of response parameters at above table.\n\n\n## Errors\n\n| error_code | error_message         |\n| ---------- | --------------------- |\n| 10000        | Missing parameter.    |\n| 10001        | API key not found.    |\n| 10002        | API key disabled.     |\n| 10003        | API key expired.      |\n| 10004        | Insufficient credits. |\n| 10005        | Unknown error.        |\n\n\n\n## Copyright\n\nCopyright (C) 2024 by MailboxValidator.com, support@mailboxvalidator.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailboxvalidator%2Fmailboxvalidator-codeigniter4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailboxvalidator%2Fmailboxvalidator-codeigniter4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailboxvalidator%2Fmailboxvalidator-codeigniter4/lists"}