PHP code example of sjaakp / yii2-donate

1. Go to this page and download the library: Download sjaakp/yii2-donate 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/ */

    

sjaakp / yii2-donate example snippets


    // ...
    'modules' => [
        'donate' => [
            'class' => sjaakp\donate\Module::class,
            // several options
        ],
    ],
    // ...


The module has to be *bootstrapped*. Do this by adding the following to the
application configuration array:

    <php
    // ...
    'bootstrap' => [
        'donate',
    ]
    // ...

There probably already is a `bootstrap` property in your configuration file; just
add `'donate'` to it.

**Important**: the module should also be set up in the same way in the console configuration (usually
called `console.php`).

#### Console command ####

To complete the installation, a [console command](https://www.yiiframework.com/doc/guide/2.0/en/tutorial-console#usage "Yii2")
have to be run. This will create a database table for the donations:

    yii migrate

The migration applied is called `sjaakp\donate\migrations\m000000_000000_init`.

## The Donate widget ##

Placing the **Donate widget** in any view is trivial:

    
    use sjaakp\donate\DonateWidget;
    

    use sjaakp\donate\DonateWidget;