Download the PHP package dmstr/yii2-cookie-button without Composer

On this page you can find all versions of the php package dmstr/yii2-cookie-button. 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 yii2-cookie-button

Yii 2 Cookie Button

Yii 2 Cookie Button based on "Twitter Bootstrap" Button or ButtonGroup. Widget to store 0/1 in a cookie for Yii2 Framework.
Add and remove cookies via javascript, with help of carhartl / jquery-cookie plugin.

Usage

Single button (default)

    $button = CookieButton::widget([
        'label' => FA::icon(FA::_EYE),
        'encodeLabel' => false,
        'toggleClass' => 'btn-primary',
        'cookieName' => 'Key-or-Name',
        'cookieValue' => 'on',
        'cookieOptions' => [
            'path' => '/',
            'http' => true,
            'expires' => strtotime('1 week')
        ],
        'options' => [
            'class' => 'btn-primary',
        ]
    ]);

Switch button

echo CookieButton::widget([
    'label' => ['On', 'Off'],           // String for default button, array for switch button
    'toggleClass' => 'btn-primary',     // Only needed if button type is switch
    'cookieName' => 'Key-or-Name',
    'cookieValue' => 'on',
    'options' => [
        'id' => 'cookieSwitchBtn',      // The button id
        'class' => 'btn-xs'             // Default button class
    ],
    'cookieOptions' => [
        'options' => [                  // 'options' are optional
            'expires' => 365,           // Define lifetime of the cookie.
                                        // Value can be a Number which will be interpreted as days
                                        // from time of creation or a Date object.
                                        // If omitted, the cookie becomes a session cookie.
            'path' => '/',              // Define the path where the cookie is valid.
                                        // By default the path of the cookie is the path of the page
                                        //where the cookie was created
                                        //(standard browser behavior).
            'domain' => 'example.com',  // Define the domain where the cookie is valid.
                                        // Default: domain of page where the cookie was created.
            'secure' => true            // If true, the cookie transmission requires a secure protocol (https).
                                        // Default: false.
        ]
    ]
]);

Installation

The preferred way to install this extension is through composer.

Add repository url to the required section of your composer.json file.

"repositories": [
    {
        "type": "git",
        "url": "https://github.com/dmstr/yii2-cookie-button.git"
    }
],

Either run

php composer.phar require dmstr/yii2-cookie-button "*"

or add

"dmstr/yii2-cookie-button": "*"

to the required section of your composer.json file.


All versions of yii2-cookie-button with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
yiisoft/yii2-bootstrap Version *
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 dmstr/yii2-cookie-button contains the following files

Loading the files please wait ....