Download the PHP package mehdibo/codeigniter-recaptcha without Composer

On this page you can find all versions of the php package mehdibo/codeigniter-recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package codeigniter-recaptcha

Codeigniter-recaptcha

This library makes it easy to use Google's reCAPTCHA V2

Contents

Installation

Via composer

If you have composer installed you can run

Copy the content of config/recaptcha.php to application/config/recaptcha.php

First time using composer

Open a terminal (commands in windows), the commands here are for linux but you can find the equivalent in windows.

  1. First thing you should do is install composer

  2. Go to your application folder: cd application

  3. Install the library: composer require mehdibo/codeigniter-recaptcha

  4. Copy the content of config/recaptcha.php to your application/config/recaptcha.php

  5. Go to application/config/config.php and set composer_autoload to TRUE

  6. That's it! check the Documentation for more details.

Manually

  1. Download the latest release.

  2. Copy libraries/Recaptcha.php to application/libraries and config/recaptcha.php to application/config.

  3. Load the library using the Codeigniter loader $this->load->library('recaptcha'), check the example.

  4. See the documentation for usage.

Documentation

Getting the keys

To use the reCAPTCHA you need a pair of keys (A secret and site keys), these can be obtained from Google by going to: https://www.google.com/recaptcha/admin

And registering a new website, make sure you tick the "reCAPTCHA V2" option.

Setting the keys

There are three ways to pass the keys to the library

In the config file

You can set the keys by editing the config/recaptcha.php config file

Using the CodeIgniter loader

By passing an array of configs to the CodeIgniter loader, more details in the "Loading the library" section.

Using the set_keys method

You can pass the keys to the set_keys methods (after loading the library) like this:

Loading the library

You can load the library like any other library:

Or if installed via composer:

And you can access the methods like this:

The $config argument is optional, It can have an array of configs to the library.

$config options are:

Setting parameters

You can set the parameters (g-recaptcha tag attributes and grecaptcha.render parameters) by using the set_parameter or set_parameters methods.

To set a parameter you can do it by calling:

Or by passing an array to set_parameters:

Where $params is an associative array of param_name => value.

When passing a parameter, omit the data- part, for example, If you want to set the data-theme parameter to dark you will do it like this:

Creating the reCAPTCHA box

To create the reCAPTCHA box's HTML code call the create_box method:

This method takes one optional parameter, an array of custom attributes, for example:

Notice: You need to have the reCAPTCHA JS code included in your code:

Validating the reCAPTCHA

The is_valid method can be called to verify that the user passed the reCAPTCHA's puzzle.

this method takes two optional parameters:

$response - the response submitted by the user, set to NULL so that it'll be taken automatically from the POST data

$ip - the user IP to be sent to Google's server

Set to FALSE to not send the IP

Set to NULL to get the user's IP automatically

And it returns an array:

Example

Here is a quick example to use the Codeigniter-recaptcha library.

Installed via composer

The Controller

Installed manually

The Controller


The view

Contributing

All contributions are welcome! Just make sure you read How to contribute


All versions of codeigniter-recaptcha with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mehdibo/codeigniter-recaptcha contains the following files

Loading the files please wait ....