Quantcast
Channel: Live News for Yii Framework
Viewing all 3378 articles
Browse latest View live

[extension] genxoft/yii2-oas3

$
0
0

Open Api Swagger 3 for Yii2 Framework

  1. Requirements
  2. Installation
  3. Integration
  4. Open Api Swagger 3 example annotation
  5. Donate
  6. LICENSE

Requirements

  • PHP 7.1
  • Yii2 Framework

Installation

The preferred way to install this wrapper is through composer.

php composer.phar require genxoft/yii2-oas3 "*"

or

composer require genxoft/yii2-oas3 "*"

or add to the require section of composer.json

"genxoft/yii2-oas3" : "*"

Integration

Add action to web controller (for example SiteController.php):

public function actions()
{
    return [
        'api-docs' => [
            'class' => 'genxoft\swagger\ViewAction',
            'apiJsonUrl' => \yii\helpers\Url::to(['/site/api-json'], true),
        ],
        'api-json' => [
            'class' => 'genxoft\swagger\JsonAction',
            'dirs' => [
                Yii::getAlias('@api/modules/api/controllers'),
                Yii::getAlias('@api/modules/api/models'),
                Yii::getAlias('@api/models'),
            ],
        ],
    ];
}

Open Api Swagger 3 example annotation

Api server description

/**
 * @OA\Info(
 *   version="1.0",
 *   title="Application API",
 *   description="Server - Mobile app API",
 *   @OA\Contact(
 *     name="John Smith",
 *     email="john@example.com",
 *   ),
 * ),
 * @OA\Server(
 *   url="https://example.com/api",
 *   description="main server",
 * )
 * @OA\Server(
 *   url="https://dev.example.com/api",
 *   description="dev server",
 * )
 */
 
class DefaultController extends Controller
{
...

Controller annotation

/**
 * @OA\Get(path="/",
 *   summary="Handshake",
 *   tags={"handshake"},
 *   @OA\Parameter(
 *     name="access-token",
 *     in="header",
 *     required=false,
 *     @OA\Schema(
 *       type="string"
 *     )
 *   ),
 *   @OA\Response(
 *     response=200,
 *     description="Returns Hello object",
 *     @OA\MediaType(
 *         mediaType="application/json",
 *         @OA\Schema(ref="#/components/schemas/Hello"),
 *     ),
 *   ),
 * )
 */
public function actionIndex()
{
... 

Model annotation

/**
 *@OA\Schema(
 *  schema="Hello",
 *  @OA\Property(
 *     property="message",
 *     type="string",
 *     description="Text message"
 *  ),
 *  @OA\Property(
 *     property="time",
 *     type="integer",
 *     description="Server current Unix time"
 *  ),
 *  @OA\Property(
 *     property="date",
 *     type="string",
 *     format="date-time",
 *     description="Server current date time"
 *  )
 *)
 */
class Hello extends Model
{
...

Donate

btn_donateCC_LG.gif

LICENSE

This curl wrapper is released under the MIT license.


[extension] abosft

$
0
0
  1. Requirements
  2. Installation
  3. Usage
  4. Resources

...overview of the extension...

Requirements

...requirements of using this extension (e.g. Yii 2.0 or above)...

Installation

...how to install the extension (e.g. composer install extensionname)...

Usage

...how to use this extension...

...can use code blocks like the following...

$model=new User;
$model->save();

Resources

DELETE THIS SECTION IF YOU DO NOT HAVE IT

...external resources for this extension...

  • [Project page](URL to your project page)
  • [Try out a demo](URL to your project demo page)

[extension] vasadibt/yii2-onesignal

$
0
0

Yii2 Onesignal api

  1. Installation
  2. Config
  3. Usage

This is a restful api to onesignal.

Total Downloads Scrutinizer Code Quality

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist vasadibt/yii2-onesignal "dev-master"

or add

"vasadibt/yii2-onesignal": "dev-master"

to the require section of your composer.json file.

Config

Once the extension is installed, you have to configure the api component:

'components' => [
    'onesignal' => [
        'class' => '\vasadibt\onesignal\OneSignal',
        'appId' => 'your-app-id-hash-code',
        'appAuthKey' => 'SetYourAppAuthKey',
        'userAuthKey' => 'SetYourUserAuthKey',
        'enabled' => YII_ENV_PROD ? true : false,
    ],
],

Usage

Call api endpoints:


Yii::$app->onesignal->apps->getAll();

Yii::$app->onesignal->devices->getOne('asd-asd-asd-asd-asd-asd');
Yii::$app->onesignal->devices->getAll();


Yii::$app->onesignal->notifications->add([
    'include_player_ids' => ['player-hash-code-12345-123456789'],
    'contents' => ["en" => 'New message'],
]);


Yii::$app->onesignal->notifications->add([
    'included_segments' => ['All'],
    'contents' => ["en" => 'New message'],
]);

[extension] rakhmatov/yii2-playmobile

[extension] stage-infraportal

$
0
0
  1. Requirements
  2. Installation
  3. Usage
  4. Resources

...overview of the extension...

Requirements

...requirements of using this extension (e.g. Yii 2.0 or above)...

Installation

...how to install the extension (e.g. composer install extensionname)...

Usage

...how to use this extension...

...can use code blocks like the following...

$model=new User;
$model->save();

Resources

DELETE THIS SECTION IF YOU DO NOT HAVE IT

...external resources for this extension...

  • [Project page](URL to your project page)
  • [Try out a demo](URL to your project demo page)

[extension] alcad/yii2-cas

$
0
0

Yii2-CAS

Simple wrapper for phpCAS in Yii2

NOTE: Module is in initial development. jasig/phpCAS is required

Configuration

config/param.php `php return [

...
'cas' => [
	'host' => 'https://app.example.com/',
	'port' => 443,
	'uri' => '/cas',
            'log_file' => '/tmp/phpCAS.log',
],
...

]; `

config/web.php `php $config = [

...
'bootstrap' => [... , 'cas'],
'components' => [
	'casUser' => [
		'class' => 'alcad\cas\CasUser',
	]
],
'modules' => [
	'cas' => [
		'class' => 'alcad\cas\Cas',
	],
]
...

] `

[extension] casbin/yii-adapter

[extension] yii2-casbin

$
0
0

Yii-Casbin

  1. Installation
  2. Usage
  3. Define your own model.conf
  4. Learning Casbin

Use Casbin in Yii 2.0 PHP Framework.

Installation

Getting Composer package

Require this package in the composer.json of your Yii 2.0 project. This will download the package.

composer require casbin/yii-adapter
Configuring application

To use this extension, you have to configure the Casbin class in your application configuration:

return [
    //....
    'components' => [
        'casbin' => [
            'class' => '\CasbinAdapter\Yii\Casbin',
            
            /*
             * Yii-casbin model setting.
             */
            'model' => [
                // Available Settings: "file", "text"
                'config_type' => 'file',
                'config_file_path' => '/path/to/casbin-model.conf',
                'config_text' => '',
            ],

            // Yii-casbin adapter .
            'adapter' => '\CasbinAdapter\Yii\Adapter',

            /*
             * Yii-casbin database setting.
             */
            'database' => [
                // Database connection for following tables.
                'connection' => '',
                // CasbinRule tables and model.
                'casbin_rules_table' => '{{%casbin_rule}}',
            ],
        ],
    ]
];

Usage

This provides the basic access to Casbin via the casbin application component:


$casbin = \Yii::$app->casbin;

$sub = 'alice'; // the user that wants to access a resource.
$obj = 'data1'; // the resource that is going to be accessed.
$act = 'read'; // the operation that the user performs on the resource.

if (true === $casbin->enforce($sub, $obj, $act)) {
    // permit alice to read data1x
} else {
    // deny the request, show an error
}

Define your own model.conf

Supported models.

Learning Casbin

You can find the full documentation of Casbin on the website.


[news] Shell extension 2.0.2 released

$
0
0

We are very pleased to announce the release of Shell extension version 2.0.2.

This version bumps psy/psysh dependency to ~0.9.3.

[extension] yiietherpad

$
0
0
  1. Requirements
  2. Installation
  3. Usage
  4. Resources

...overview of the extension...

Requirements

...requirements of using this extension (e.g. Yii 2.0 or above)...

Installation

...how to install the extension (e.g. composer install extensionname)...

Usage

...how to use this extension...

...can use code blocks like the following...

$model=new User;
$model->save();

Resources

DELETE THIS SECTION IF YOU DO NOT HAVE IT

...external resources for this extension...

  • [Project page](URL to your project page)
  • [Try out a demo](URL to your project demo page)

[extension] bizley/jwt

$
0
0

Latest Stable VersionTotal Downloads LicenseBuild Status

JWT Integration For Yii 2

  1. Installation
  2. Basic usage
  3. JSON Web Tokens

This extension provides the JWT integration for Yii 2 framework.

This is fork of sizeg/yii2-jwt package

Installation

Add the package to your composer.json:

{
    "require": {
        "bizley/jwt": "^2.0"
    }
}

and run composer update or alternatively run composer require bizley/jwt:^2.0

Basic usage

Add jwt component to your configuration file:

[
    'components' => [
        'jwt' => [
            'class' => \bizley\jwt\Jwt::class,
            'key' => ... // Secret key string or path to the public key file
        ],
    ],
],

Now you have got access to JWT library through Yii::$app->jwt and some helper methods like getBuilder(), getParser(), and getValidationData(). You can validate your JSON Web Token by using validateToken() method and check its signature with verifyToken().

REST authentication

Configure the authenticator behavior in controller.

class ExampleController extends Controller
{
    public function behaviors()
    {
        $behaviors = parent::behaviors();
        
        $behaviors['authenticator'] = [
            'class' => \bizley\jwt\JwtHttpBearerAuth::class,
        ];

        return $behaviors;
    }
}

For other configuration options refer to the Yii 2 Guide.

JWT Basic Usage

Please refer to the lcobucci/jwt Documentation.

JSON Web Tokens

[extension] aryelds/yii2-sweet-alert

$
0
0

yii2-sweet-alert

  1. Installation
  2. Usage
  3. For more options visit the plugin page
  4. License

Simple way to flash sweet alert messages to the screen. This widget is a wrapper by SweetAlert Plugin

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require aryelds/yii2-sweet-alert "@dev"

or add

"aryelds/yii2-sweet-alert": "@dev"

to the `require` section of your composer.json file.

Usage

Basic Message
use aryelds\sweetalert\SweetAlert;

echo SweetAlert::widget([
    'options' => [
        'title' => "Here's a message!"
    ]
]);
A title with a text under
use aryelds\sweetalert\SweetAlert;

echo SweetAlert::widget([
    'options' => [
        'title' => "Here's a message!",
        'text' => "It's pretty, isn't it?"
    ]
]);
Success message
use aryelds\sweetalert\SweetAlert;

echo SweetAlert::widget([
    'options' => [
        'title' => "Good Job!",
        'text' => "You clicked the button!",
        'type' => SweetAlert::TYPE_SUCCESS
    ]
]);

Error message
use aryelds\sweetalert\SweetAlert;

echo SweetAlert::widget([
    'options' => [
        'title' => "Error!",
        'text' => "An error happened!",
        'type' => SweetAlert::TYPE_ERROR
    ]
]);

A warning with "confirm" and "cancel" function
use aryelds\sweetalert\SweetAlert;

echo SweetAlert::widget([
    'options' => [
        'title' => "Are you sure?",
        'text' => "You will not be able to recover this imaginary file!",
        'type' => SweetAlert::TYPE_WARNING,
        'showCancelButton' => true,
        'confirmButtonColor' => "#DD6B55",
        'confirmButtonText' => "Yes, delete it!",
        'cancelButtonText' => "No, cancel plx!",
        'closeOnConfirm' => false,
        'closeOnCancel' => false
    ],
    'callbackJs' => new \yii\web\JsExpression(' function(isConfirm) {
        if (isConfirm) { 
            swal("Deleted!", "Your imaginary file has been deleted.", "success");
        } else { 
            swal("Cancelled", "Your imaginary file is safe :)", "error");
        }
    }')
]);

A replacement for the "prompt" function
use aryelds\sweetalert\SweetAlert;

echo SweetAlert::widget([
    'options' => [
        'title' => "An input!",
        'text' => "Write something interesting:",
        'type' => SweetAlert::TYPE_INPUT,
        'showCancelButton' => true,
        'closeOnConfirm' => false,
        'animation' => "slide-from-top",
        'inputPlaceholder' => "Write something"
    ],
    'callbackJs' => new \yii\web\JsExpression(' function(inputValue) {
        if (inputValue === false) return false;
        if (inputValue === "") { 
            swal.showInputError("You need to write something!");
            return false
        }
        swal("Nice!", "You wrote: " + inputValue, "success");
    }')
]);

Html Message
use aryelds\sweetalert\SweetAlert;
use yii\bootstrap\Html;

echo SweetAlert::widget([
    'options' => [
        'title' => Html::tag('small', 'HTML Message!', ['style' => 'color: #00008B']),
        'text' => Html::tag('h2', 'Custom Message'),
        'type' => SweetAlert::TYPE_INFO,
        'html' => true
    ]
]);

Using SweetAlert with flash messages
Controller Example
public function actionPage() {
    $model = new SomeModel();
    
    Yii::$app->getSession()->setFlash('success', [
        'text' => 'My custom text',
        'title' => 'My custom title',
        'type' => 'success',
        'timer' => 3000,
        'showConfirmButton' => false
    ]);

    return $this->render('page', [
        'model' => $model,
    ]);
}
The View
use aryelds\sweetalert\SweetAlert;

foreach (Yii::$app->session->getAllFlashes() as $message) {
    echo SweetAlert::widget([
        'options' => [
            'title' => (!empty($message['title'])) ? Html::encode($message['title']) : 'Title Not Set!',
            'text' => (!empty($message['text'])) ? Html::encode($message['text']) : 'Text Not Set!',
            'type' => (!empty($message['type'])) ? $message['type'] : SweetAlert::TYPE_INFO,
            'timer' => (!empty($message['timer'])) ? $message['timer'] : 4000,
            'showConfirmButton' =>  (!empty($message['showConfirmButton'])) ? $message['showConfirmButton'] : true
        ]
    ]);
}
Using themes
You can select one of the following options:
SweetAlert::THEME_TWITTER
SweetAlert::THEME_GOOGLE
SweetAlert::THEME_FACEBOOK
Example:
use aryelds\sweetalert\SweetAlert;

echo SweetAlert::widget([
    'options' => [
        'title' => 'Themes!',
        'text' => 'Here\'s the Twitter theme for SweetAlert!',
        'confirmButtonText' => "Cool!",
        'animation' => 'slide-from-top',
        'theme' => SweetAlert::THEME_TWITTER
    ]
]);

For more options visit the plugin page

SweetAlert

License

yii2-sweet-alert is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

[extension] rockman84/yii2-slack-client

[extension] yetopen/yii2-usuario-ldap

[extension] alcea/yii2-prism-syntax-highlighter

$
0
0

Latest Stable Version Total Downloads Latest Unstable Version License

YII2 Prism Syntax Highlighter

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s used in thousands of websites, including some of those you visit daily.

How to install?

1. Use composer
composer require alcea/yii2-prism-syntax-highlighter "~1"
2. or, edit require section from composer.json
"alcea/yii2-prism-syntax-highlighter": "~1"
3. or, clone from GitHub
git clone https://github.com/alceanicu/yii2-prism-syntax-highlighter

How to use?

<?php

use alcea\yii2PrismSyntaxHighlighter\PrismSyntaxHighlighter;
 
PrismSyntaxHighlighter::widget([
    'theme' => PrismSyntaxHighlighter::THEME_DEFAULT,
    'languages' => ['php', 'php-extras', 'css'],
    'plugins' => ['copy-to-clipboard']
]);

$md = <<<MD_FILE
'''js
$(document).on('focusout', 'input[name="test"]', function(event) {
	event.preventDefault();
	// do ...
});
'''
MD_FILE;

echo Markdown::process($md, 'gfm-comment');
PrismJs page http://prismjs.com/download.html

[extension] skeeks/yii2-ya-slug

$
0
0

Yii2 yandex slug (Semantic URL)

  1. Installation
  2. How to use
  3. Links
  4. Demo (view urls)

This solution allows you to generate good slug urls. (slug wiki).

Direct generation is engaged in a proven solution cocur/slugify.

Transliteration yandex http://translit-online.ru/yandex.html

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/yii2-ya-slug "*"

or add

"skeeks/yii2-ya-slug": "*"

How to use

behavior

Attach the behavior in your model:

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'skeeks\yii2\yaslug\YaSlugBehavior',
            'slugAttribute' => 'slug',                      //The attribute to be generated
            'attribute' => 'name',                          //The attribute from which will be generated
            // optional params
            'maxLength' => 64,                              //Maximum length of attribute slug
            'minLength' => 3,                               //Min length of attribute slug
            'ensureUnique' => true,
        ]
    ];
}

helper
echo skeeks\yii2\yaslug\YaSlugBehavior::slugify("Тестовая строка");

Links

Demo (view urls)

skeeks!
SkeekS CMS (Yii2) — fast, simple, effective!
skeeks.com | cms.skeeks.com

[extension] skeeks/yii2-assets-auto-compress

$
0
0

Automatically compile and merge files js + css + html in yii2 project.

  1. Installation
  2. How to use
  3. Links
  4. Demo (view source code)
  5. Screenshot

This solution enables you to dynamically combine js and css files to optimize the html page. This allows you to improve the performance of google page speed.

This tool only works on real sites. On the local projects is not working!

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/yii2-assets-auto-compress "*"

or add

"skeeks/yii2-assets-auto-compress": "*"

How to use

//App config
[
    'bootstrap'    => ['assetsAutoCompress'],
    'components'    =>
    [
    //....
        'assetsAutoCompress' =>
        [
            'class'         => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
        ],
    //....
    ]
]

//App config with all options
[
    'bootstrap'  => ['assetsAutoCompress'],
    'components' => [
        //....
        'assetsAutoCompress' => [
            'class'   => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
            'enabled' => true,

            'readFileTimeout' => 3,           //Time in seconds for reading each asset file

            'jsCompress'                => true,        //Enable minification js in html code
            'jsCompressFlaggedComments' => true,        //Cut comments during processing js

            'cssCompress' => true,        //Enable minification css in html code

            'cssFileCompile'        => true,        //Turning association css files
            'cssFileRemouteCompile' => false,       //Trying to get css files to which the specified path as the remote file, skchat him to her.
            'cssFileCompress'       => true,        //Enable compression and processing before being stored in the css file
            'cssFileBottom'         => false,       //Moving down the page css files
            'cssFileBottomLoadOnJs' => false,       //Transfer css file down the page and uploading them using js

            'jsFileCompile'                 => true,        //Turning association js files
            'jsFileRemouteCompile'          => false,       //Trying to get a js files to which the specified path as the remote file, skchat him to her.
            'jsFileCompress'                => true,        //Enable compression and processing js before saving a file
            'jsFileCompressFlaggedComments' => true,        //Cut comments during processing js

            'noIncludeJsFilesOnPjax' => true,        //Do not connect the js files when all pjax requests

            'htmlFormatter' => [
                //Enable compression html
                'class'         => 'skeeks\yii2\assetsAuto\formatters\html\TylerHtmlCompressor',
                'extra'         => false,       //use more compact algorithm
                'noComments'    => true,        //cut all the html comments
                'maxNumberRows' => 50000,       //The maximum number of rows that the formatter runs on

                //or

                'class' => 'skeeks\yii2\assetsAuto\formatters\html\MrclayHtmlCompressor',

                //or any other your handler implements skeeks\yii2\assetsAuto\IFormatter interface

                //or false
            ],
        ],
        //....
    ],
];

Links

Demo (view source code)

Screenshot

SkeekS CMS admin panel

SkeekS CMS admin panel

SkeekS CMS admin panel

SkeekS CMS admin panel

skeeks!
SkeekS CMS (Yii2) — fast, simple, effective!
skeeks.com | cms.skeeks.com

[extension] skeeks/yii2-slug-behavior

$
0
0

Yii2 slug behavior (Semantic URL)

  1. Installation
  2. How to use
  3. Links
  4. Demo (view urls)

This solution allows you to generate good slug urls. (slug wiki).

Direct generation is engaged in a proven solution cocur/slugify.

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/yii2-slug-behavior "*"

or add

"skeeks/yii2-slug-behavior": "*"

How to use

Attach the behavior in your model:

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'skeeks\yii2\slug\SlugBehavior',
            'slugAttribute' => 'slug',                      //The attribute to be generated
            'attribute' => 'name',                          //The attribute from which will be generated
            // optional params
            'maxLength' => 64,                              //Maximum length of attribute slug
            'minLength' => 3,                               //Min length of attribute slug
            'ensureUnique' => true,
            'slugifyOptions' => [
                'lowercase' => true,
                'separator' => '-',
                'trim' => true
                //'regexp' => '/([^A-Za-z0-9]|-)+/',
                //'rulesets' => ['russian'],
                //@see all options https://github.com/cocur/slugify
            ]
        ]
    ];
}

Yandex translit http://translit-online.ru/yandex.html:

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'skeeks\yii2\slug\SlugBehavior',
            'slugAttribute' => 'slug',                      //The attribute to be generated
            'attribute' => 'name',                          //The attribute from which will be generated
            // optional params
            'slugifyOptions' => [
                'rulesets' => [
                    skeeks\yii2\slug\SlugRuleProvider::YANDEX, 
                    'default'
                ]
            ]
        ]
    ];
}

Links

Demo (view urls)

skeeks!
SkeekS CMS (Yii2) — fast, simple, effective!
skeeks.com | cms.skeeks.com

[extension] skeeks/yii2-external-links

$
0
0

AutoCorrect external links after rendering html page

  1. Installation
  2. How to use (simple)
  3. How to use (advanced)
  4. Screenshot

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/yii2-external-links "*"

or add

"skeeks/yii2-external-links": "*"

How to use (simple)

//App config
[
    'bootstrap'    => ['externalLinks'],

    'components'    =>
    [
        //....
        'externalLinks' =>
        [
            'class' => 'skeeks\yii2\externalLinks\ExternalLinksComponent',
        ],
        //....
    ],

    'modules'    =>
    [
        //....
        'externallinks' =>
        [
            'class' => 'skeeks\yii2\externalLinks\ExternalLinksModule',
        ],
        //....
    ]
]

How to use (advanced)

//App config
[
    'bootstrap'    => ['externalLinks'],

    'components'    =>
    [
        //....
        'externalLinks' =>
        [
            'class' => 'skeeks\yii2\externalLinks\ExternalLinksComponent',

            //Additional
            'enabled'                           => true,
            'noReplaceLocalDomain'              => true,
            'backendRoute'                      => '/externallinks/redirect/redirect',
            'backendRouteParam'                 => 'url',
            'enabledB64Encode'                  => true,
            'noReplaceLinksOnDomains'           => [
                'site1.ru',
                'www.site1.ru',
                'site2.ru',
            ],
        ],
        
        'urlManager' => 
        [
            'rules' => 
            [
                //Rewriting the standard route
                //And add robots.txt  Disallow: /~*
                '~skeeks-redirect'                        => '/externallinks/redirect/redirect',
            ]
        ]
        //....
    ],

    'modules'    =>
    [
        //....
        'externallinks' =>
        [
            'class' => 'skeeks\yii2\externalLinks\ExternalLinksModule',
        ],
        //....
    ]
]

Screenshot

SkeekS CMS admin panel

skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com

[extension] skeeks/yii2-google-api

$
0
0

Component for work with official google api

  1. Installation
  2. How to use

Partly wrapper over powerful official package from google — google/apiclient

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/yii2-google-api "*"

or add

"skeeks/yii2-google-api": "*"

How to use

Configuration app
//App config
[
    'components'    =>
    [
    //....
        'googleApi' =>
        [
            'class'                 => '\skeeks\yii2\googleApi\GoogleApiComponent',
            'developer_key'         => 'YOUR_GOOLE_API_KEY',
        ],
    //....
    ]
]

An example of the Api transliteration

https://cloud.google.com/translate/v2/using_rest


$service = new Google_Service_Translate(\Yii::$app->googleApi->client);
$result = $service->languages->listLanguages([
    'target' => 'ru'
]);
print_r($result);


$result = $service->translations->listTranslations('apple', 'ru');
print_r($result);

skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com

Viewing all 3378 articles
Browse latest View live