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

[extension] skeeks/yii2-proxmox

$
0
0

ProxmoxVE API Client for yii2

  1. Installation
  2. Usage
  3. Docs

Latest Stable Version Total Downloads

Installation

$ composer require skeeks/yii2-proxmox "*"

Or add this to your composer.json file:

{
    "require": {
        "skeeks/yii2-proxmox": "*"
    }
}

Usage

Config:


    'proxmox' => [
        'class'     => 'skeeks\proxmox\ProxmoxComponent',
        'hostname'  => 'server1.proxmox.com',
        'username'  => 'root',
        'password'  => 'password',
        //'realm'     => 'pam', //pve
        //'port'      => '8006',
    ],

    'proxmox2' => [
        'class'     => 'skeeks\proxmox\ProxmoxComponent',
        'hostname'  => 'server2.proxmox.com',
        'username'  => 'root',
        'password'  => 'password',
        //'realm'     => 'pam', //pve
        //'port'      => '8006',
    ],

````

Usage:

```php

if (\Yii::$app->proxmox->api)
{
    $allNodes = \Yii::$app->proxmox->api->get('/nodes');
    print_r($allNodes);
} else
{
    //\Yii::$app->proxmox->error — \Exception
    \Yii::$app->proxmox->error->getMessage();
}


if (\Yii::$app->proxmox2->api)
{
    \Yii::$app->proxmox2->api->get('/nodes');
}

....

````


Sample output:

```php
Array
(
    [data] => Array
        (
            [0] => Array
                (
                    [disk] => 2539465464
                    [cpu] => 0.031314446882002
                    [maxdisk] => 30805066770
                    [maxmem] => 175168446464
                    [node] => mynode1
                    [maxcpu] => 24
                    [level] =>
                    [uptime] => 139376
                    [id] => node/mynode1
                    [type] => node
                    [mem] => 20601992182
                )

        )

)
// It is common to fetch images and then use base64 to display the image easily in a webpage
\Yii::$app->proxmox->api->setResponseType('pngb64'); // Sample format: data:image/png;base64,iVBORw0KGgoAAAA...
$base64 = \Yii::$app->proxmox->api->get('/nodes/hosting4-skeeks/rrd', ['ds' => 'cpu', 'timeframe' => 'day']);
// So we can do something like this
echo "<img src='{$base64}' \>";
// Ask for nodes, gives back a PHP string with HTML response
\Yii::$app->proxmox->api->get('/nodes');

// Change response type to JSON
\Yii::$app->proxmox->api->setResponseType('json');

// Now asking for nodes gives back JSON raw string
\Yii::$app->proxmox->api->get('/nodes');

// If you want again return PHP arrays you can use the 'array' format.
\Yii::$app->proxmox->api->setResponseType('array');

// Also you can call getResponseType for whatever reason you have
$responseType = \Yii::$app->proxmox->api->getResponseType();  // array

Docs

On your proxmox client object you can use get(), create(), set() and delete() functions for all resources specified at [PVE2 API Documentation], params are passed as the second parameter in an associative array.

What resources or paths can I interact with and how?

In your proxmox server you can use the pvesh CLI Tool to manage all the pve resources, you can use this library in the exact same way you would use the pvesh tool. For instance you could run pvesh then, as the screen message should say, you can type help [path] [--verbose] to see how you could use a path and what params you should pass to it. Be sure to read about the pvesh CLI Tool at the [Proxmox wiki].

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


[extension] skeeks/yii2-http-basic-auth

$
0
0

Http basic auth for Yii2 project

  1. Installation
  2. Configuration app
  3. Exemple 1
  4. Exemple 2

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-http-basic-auth "*"

or add

"skeeks/yii2-http-basic-auth": "*"

Configuration app

Exemple 1


'on beforeRequest' => function ($event) {
    \Yii::$app->httpBasicAuth->verify();
},

'components' =>
[
    'httpBasicAuth' =>
    [
        'class'             => 'skeeks\yii2\httpBasicAuth\HttpBasicAuthComponent',
        'login'             => 'login',
        'password'          => 'password',
        'usePasswordHash'   => false,                               //optionality
        'viewFail'          => '@app/views/http-basic-auth-fail'    //optionality
    ],

]

Exemple 2


'on beforeRequest' => function ($event) {
    //For example in addition to close the admin panel http authorization
    if (\Yii::$app->admin->requestIsAdmin)
    {
        \Yii::$app->httpBasicAuth->verify();
    }
},

'components' =>
[
    'httpBasicAuth' =>
    [
        'class'             => 'skeeks\yii2\httpBasicAuth\HttpBasicAuthComponent',
        'login'             => 'login',
        'password'          => 'password',
    ],

]

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

[extension] skeeks/yii2-schedule-input-widget

$
0
0

Work schedule widget for yii2

  1. Installation
  2. How to use without model
  3. How to use with model
  4. Screenshot
  5. Video
  6. Links

A small element for the form of the yii2 framework. Allows you to select working days and time for working on them. Ability to select multiple ranges for one day.

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-schedule-input-widget "*"

or add

"skeeks/yii2-schedule-input-widget": "*"

How to use without model


\skeeks\yii2\scheduleInputWidget\ScheduleInputWidget::widget([
    'name' => 'schedule'
]);

How to use with model


$form = new \yii\widgets\ActiveForm();

$form->field($model, 'schedule')->widget(
    \skeeks\yii2\scheduleInputWidget\ScheduleInputWidget::class
);

Screenshot

Work schedule widget for yii2

Work schedule widget for yii2

Video

Work schedule widget for yii2

Links

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

[news] Auth Client extension 2.1.8 released

$
0
0

We are very pleased to announce the release of Auth Client extension version 2.1.8.

It fixes a redirect bug in LinkedIn provider, changes Google client to use Google Sign-in API instead of Google Plus and adds two enhancements for AuthAction:

  • Ability to configure user component used.
  • Ability to to pass buildAuthUrl params to OAuth flows.

See the CHANGELOG for details.

[news] Bootstrap 4 extension version 2.0.0 released

[extension] yiisoft/yii2-bootstrap4

$
0
0

bootstrap-solid.svg

Twitter Bootstrap 4 Extension for Yii 2

  1. Installation
  2. Usage

This is the Twitter Bootstrap extension for Yii framework 2.0. It encapsulates Bootstrap 4 components and plugins in terms of Yii widgets, and thus makes using Bootstrap components/plugins in Yii applications extremely easy.

For license information check the LICENSE-file.

Documentation is at docs/guide/README.md.

Latest Stable Version Total Downloads Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiisoft/yii2-bootstrap4

or add

"yiisoft/yii2-bootstrap4": "~1.0.0"

to the require section of your composer.json file.

Usage

For example, the following single line of code in a view file would render a Bootstrap Progress plugin:

<?= yii\bootstrap4\Progress::widget(['percent' => 60, 'label' => 'test']) ?>

[news] Bootstrap extension version 2.0.9 released

$
0
0

We are very pleased to announce the release of Bootstrap extension version 2.0.9 which updates asset constraint to use Bootstrap 3.4.x.

[news] Yii 2.0.16 is released

$
0
0
  1. Active Record
  2. Migrations
  3. Databases
  4. Helpers
  5. GridView
  6. jQuery
  7. Mutex
  8. Security fixes
  9. Project templates
  10. A bit about Yii 3.0

We are very pleased to announce the release of Yii Framework version 2.0.16. Please refer to the instructions at https://www.yiiframework.com/download/ to install or upgrade to this version.

Version 2.0.16 is a minor release of Yii 2.0 which contains more than a hundred enhancements and bug fixes including security fixes.

Yii 2.0 reached feature freeze more than a year ago, meaning that the 2.0 branch will only receive bug fixes. That was done in order to allow the Yii Team to focus on the upcoming Yii 3 rewrite. There's more on Yii 3 at the very end of this announcement.

There are minor changes that may affect your existing applications, so make sure to check the UPGRADE.md file.

Huge thanks to all Yii community members who contribute to the framework. It wouldn't have been possible without you. Additional thanks to translators who are keeping international documentation up to date.

There are many active Yii communities so if you need help or want to share your experience, feel free to join them.

You can also discuss this news on our forum.

Below we summarize some of the enhancements and changes that slipped into this release. A complete list of changes can be found in the CHANGELOG.

Active Record

A behavior for optimistic locking was added by Salem Ouerdani, @tunecino.

Optimistic locking allows multiple users to access the same record for edits and avoids potential conflicts. In case when a user attempts to save the record upon some staled data (because another user has modified the data), a StaleObjectException exception will be thrown, and the update or deletion is skipped.

The locking itself was implemented from the first versions of Yii but using it properly wasn't easy. Now it is. You can find details in the guide section on optimistic locks and in OptimisticLockBehavior itself.

Migrations

Console migration generator defaults were changed so that the migrations are generated with table prefixes used. If you want to disable this behavior, set yii\console\controllers\MigrateController::useTablePrefix to false via console command mappings.

Databases

  • The MySQL driver now supports fractional seconds for time types (require MySQL >= 5.6.4).
  • The Oracle driver now supports resetting sequences.

Helpers

  • yii\helpers\Inflector now works correctly with UTF-8.
  • Added yii\mutex\FileMutex::$isWindows for Windows file shares on Unix guest machines.
  • yii\helpers\UnsetArrayValue, yii\helpers\ReplaceArrayValue object can now be restored after serialization using var_export() function.

GridView

Added $filterOnFocusOut option that allows to toggle if filtering should be triggerd when filter field is losing focus.

jQuery

jQuery 3.3 is now allowed to be installed.

Mutex

  • Increased frequency of lock tries for yii\mutex\FileMutex::acquireLock() when $timeout is provided.
  • Added support for $timeout in yii\mutex\PgsqlMutex::acquire().

Security fixes

Two security issues were fixed in this release:

  • CVE-2018-14578: CSRF token check bypassing in \yii\web\Request::getMethod()
  • CVE-2018-19454: Excess logging of sensitive information in \yii\log\Target

Project templates

  • Codeception configs were cleaned up in both basic and advanced project templates.
  • A basic Docker configuration was added to the Advanced project template, allowing you to quickly start developing.
  • Advanced template tests require newer version of Codeception that works starting with PHP 7.0. Old applications will work with older versions of Codeception so there's no need for upgrade if you don't want it.

A bit about Yii 3.0

Yii 3 will be the next major version of the Yii framework. A separate announcement will be made subsequently, but here's a brief overview of the future:

A new architecture: The Yii framework has been split into several packages. This will allow you to pick the packages you need to compose your Yii application instead of installing one package that provides everything.

JavaScript-agnostic: With the reorganization of the source code, Yii will no longer tie you to a specific JavaScript framework. Core features of Yii have been rewritten to be jQuery-free.

PSR Compatibility: Yii 3 will embrace the PHP-FIG recommendations, and implement many PSRs: Logging, Caching, DI, etc.

Yii 3.0 is currently being developed. We will make separate announcements when it reaches alpha stability.


[extension] skeeks/app-shop-smarty

$
0
0

Shop on SkeekS CMS (Yii2)

  1. Links
  2. Install
  3. Other
  4. Video
  5. Screenshots

skeeks!

Latest Stable Version Total Downloads

Links

Install

# Download latest version of composer
curl -sS https://getcomposer.org/installer | COMPOSER_HOME=.composer php
# Installing the base project SkeekS CMS
COMPOSER_HOME=.composer php composer.phar create-project --prefer-dist --stability=dev skeeks/app-shop-smarty demo.ru
# Going into the project folder
cd demo.ru

# Download latest version of composer
curl -sS https://getcomposer.org/installer | COMPOSER_HOME=.composer php

#Edit the file to access the database, it is located at common/config/db.php

#Update configs
COMPOSER_HOME=.composer php composer.phar self-update && COMPOSER_HOME=.composer php composer.phar du

#Installation of ready-dump
php yii migrate -t=migration_install -p=backup/migrations

Other

sudo -i -u postgres

pgloader mysql://shop:jW4mKYSVRVZPGyNn@localhost/shop_smarty pgsql:///test

pgloader -v -L ~/pgloader.log migrate.load

migrate.load

load database
from      mysql://shop:jW4mKYSVRVZPGyNn@127.0.0.1:3306/shop_smarty
into pgsql:///test
ALTER SCHEMA 'shop_smarty' RENAME TO 'public';

http://www.linuxandubuntu.com/home/difference-between-postgresql-and-mysql-and-how-to-migrate-from-mysql-to-postgresql

Video

Shop on SkeekS CMS (Yii2)

Screenshots

skeeks! skeeks!

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

[extension] kosv/yii2-grid-roweditable

$
0
0

Yii2 Grid RowEditable

  1. Установка
  2. Терминология
  3. Как использовать?
  4. Конфигурирование
  5. Описание параметров конфигурации

Yii2 расширение для редактирования данных в GridView

Установка

Данное расширение лучше устанавливать через composer

Выполните `bash $ composer require kosv/yii2-grid-roweditable:1.0. Или добавьтеjson "kosv/yii2-grid-rowEditable": "1.0." ` в секцию require файла composer.json.

Терминология

Данное расширение - Yii2 Grid RowEditable.
YourGridView - для использования данного расширения, вам нужно иметь/создать дочерний класс от GridView, поэтому в контексте документации, ваш GridView будем называть YourGridView.
YourSaveForm - вам нужно будет создать форму, в которой будет выолнятся валидация и сохранение данных. В контексте даннной документации, такую форму будем называть YourSaveForm.

Как использовать?

Весь этап можно разделить на 6 шагов:

  1. Нужно подключить данное расширение к YourGridView.
  2. Нужно реализовать YourSaveForm, - в данном классе будет выполнятся процесс валидации и сохранения данных.
  3. В экшене вашего контроллера, создать объект YourSaveForm и написать условие для сохранения данных формы.
  4. Нужно вывести YourGridView в вашем View, и указать обязательные общие параметры редактирования.
  5. В список столбцов добавить Kosv\Yii2Grid\RowEditable\Select\CheckboxColumn - это столбец чекбоксов, который позволяет выбирать строки.
  6. Вывести кнопку сохранения изменений.
Шаг 1. Инициализация YourGridView

Если в приложении нет дочернего класса GridView, то создайте его в любом месте вашего приложения `php namespace app\widgets;

use yii\grid\GridView as YiiGridView;

class YourGridView extends YiiGridView { } ` К YourGridView подключите интерфейс Kosv\Yii2Grid\RowEditable\EditableGridInterface,
и трейт Kosv\Yii2Grid\RowEditable\EditableGridTrait

namespace app\widgets;

use Kosv\Yii2Grid\RowEditable\EditableGridInterface;
use Kosv\Yii2Grid\RowEditable\EditableGridTrait;
use yii\grid\GridView as YiiGridView;

class YourGridView extends YiiGridView implements EditableGridInterface
{
    use EditableGridTrait;
}
Шаг 2. Создание YourSaveForm

Создайте класс формы, и унаследуйти его от yii\base\Model(или от любого другого потомка yii\base\Model)

namespace app\models;

use yii\base\Model;

/**
 * @property array $editingRows
 */
class YourSaveForm extends Model
{
}

К YourSaveForm подключите итерфейс Kosv\Yii2Grid\RowEditable\Form\SaveFormInterface и трейт Kosv\Yii2Grid\RowEditable\Form\SaveFormTrait

namespace app\models;

use Kosv\Yii2Grid\RowEditable\Form\SaveFormInterface;
use Kosv\Yii2Grid\RowEditable\Form\SaveFormTrait;
use yii\base\Model;

/**
 * @property array $editingRows
 */
class YourSaveForm extends Model implements SaveFormInterface
{
    use SaveFormTrait;
}

В YourSaveForm реализуйте методы: validateEditableRows(отвечает за валидацию данных), и saveEditableRows(отвечает за сохранение данных). По умолчанию, данные методы не имеют реализации, поэтому вы должы сами позаботится о том, как будут валидироваться и сохраняться ваши данные.

namespace app\models;

use Kosv\Yii2Grid\RowEditable\Form\SaveFormInterface;
use Kosv\Yii2Grid\RowEditable\Form\SaveFormTrait;
use yii\base\Model;

/**
 * @property array $editingRows
 */
class YourSaveForm extends Model implements SaveFormInterface
{
    use SaveFormTrait;
    
    /**
     * @return bool
     */
    public function validateEditableRows()
    {
        // TODO: Ваша логика валидации данных из массива $this->editingRows
    }
    
    /**
     * @return bool
     */
    public function saveEditableRows()
    {
        // TODO: Ваша логика сохранения данных из массива $this->editingRows
    }
}
Шаг 3. Создание и сохранение YourSaveForm в экшене вашего контроллера
public function actionIndex()
{
    $gridSaveForm = new app\models\YourSaveForm();
    if ($gridSaveForm->load(Yii::$app->request->post()) &&
        $gridSaveForm->validate() &&
        $gridSaveForm->validateEditableRows()) {
        
        $gridSaveForm->saveEditableRows();
    }
    
    return $this->render('index', [
        'gridSaveForm' => $gridSaveForm,
    ]);
}
Шаг 4. Вывод и обязательные параметры

Выведите YourGridView в представлении и укажите обязательный параметр form

<?php
/** @var $gridSaveForm app\models\YourSaveForm */

use app\widgets\YourGridView;

echo YourGridView::widget([
    ...
    'commonEditParams' => [
        'form' => $gridSaveForm,
        ...
    ],
])
Шаг 5. Колонка с чекбоксами для выбора строки

В массив колонок добавьте Kosv\Yii2Grid\RowEditable\Select\CheckboxColumn `php <?php /* @var $gridSaveForm app\models\YourSaveForm /

use Kosv\Yii2Grid\RowEditable\Select\CheckboxColumn; use app\widgets\YourGridView;

echo YourGridView::widget([

...
'commonEditParams' => [
    'form' => $modelOfSaveForm,
    ...
],
'columns' => [
    ...
    ['class' => CheckboxColumn::class],
],

]) `

Шаг 6. Кнопка для сохранения данных

В любом месте страницы, выведите кнопку для сохранения данных `php <?php echo Html::button('Save', [

'class' => \Kosv\Yii2Grid\RowEditable\Config\EditConfigInterface::DEFAULT_CLASS_SAVE_BTN

]) ?> `

Конфигурирование

Данное расширение можно конфигурировать как для отдельных столбцов, так и использовать общии парметры конфигурации.
Более подробную информации о всех праметрах можно получить в разделе описания параметров конфигурации

Общии параметры конфигурации

Данный вид парметров задаётся в commonEditParams: `php echo YourGridView::widget([

...
'commonEditParams' => [
    // Общие параметры
    'form' => $saveForm,
],

]) `

Конфигурация столбцов

Если в массиве columns вашего YourGridView, есть столбцы без явно указанного типа (задаётся через поле class), то по умолчанию будет использоваться столбец с типом Kosv\Yii2Grid\RowEditable\EditableRowColumn.
Все столбцы типа Kosv\Yii2Grid\RowEditable\EditableRowColumn можно конфигурируются точно также как и commonEditParams, только параметры кофигурации задаются через поле editParams

echo YourGridView::widget([
    ...
    'commonEditParams' => [
        // Общие параметры редактирования
        'form' => $saveForm,
        'input' => \Kosv\Yii2Grid\RowEditable\Input\Input::class
        ...
    ],
    'columns' => [
        [
            ...
            'editParams' => [
                // Параметры редактирования столбца 
                'input' => \Kosv\Yii2Grid\RowEditable\Input\DropDownList::class
                ...
            ],            
        ],
    ],
])

Список параметров из commonEditParams, которые нельзя предопределить в столбце: prefix, gridCssClass, selectMode, saveAction, saveMethod, saveButton.

Описание параметров конфигурации

# Модель формы в которой выполняется валидация и сохранение данных.
# - Обязательный параметр
# - Тип yii\base\Model
# - Нельзя предопределить в столбце
'form' => $saveFrom,

# Атрибут формы в который будут загружатся данные в виде массива.
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'editingRows'
# - Нельзя предопределить в столбце
'formAttribute' => 'editingRows',

# Вклчить режим редактирования
# - Необязательный параметр
# - Тип boolean
# - Значение по умолчанию true
# - Можно предопределить в столбце
'enable' => true

# CSS класс для RowEditable. Будет добавлен к виджету GridView
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'gre-grid-view'
# - Нельзя предопределить в столбце
'gridCssClass' => 'gre-grid-view',

# Html input для редактирования значений столбца
# - Необязательный параметр
#
# - Тип \Closure. Функция должна возвращать строку с Html 
# - Тип array. В массиве должна быть представлена кофигурация реализации Kosv\Yii2Grid\RowEditable\Input\InputInterface
# - Тип string. Строка дожна быть именем класса, который реализует Kosv\Yii2Grid\RowEditable\Input\InputInterface
#
# - Значение по умолчанию Kosv\Yii2Grid\RowEditable\Input\Input::class
# - Можно предопределить в столбце
'input' => Kosv\Yii2Grid\RowEditable\Input\Input::class,

# Html класс для блока с input'ом
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'input-wrap'
# - Можно предопределить в столбце
'inputWrapHtmlClass' => 'input-wrap',

# Html тег для блока с input'ом
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'div'
# - Можно предопределить в столбце
'inputWrapHtmlTag' => 'div',

# Префикс плагина. Будет добавлятся к html data-атрибутам
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'gre'
# - Нельзя предопределить в столбце
'prefix' => 'gre',

# Экшен для формы сохранения данных
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию ''
# - Нельзя предопределить в столбце
'saveAction' => '',

# Кнопка для формы сохранения данных
# - Необязательный параметр
# - Тип string. jQuery селектор кнопки
# - Значение по умолчанию '.gre-save-btn'
# - Нельзя предопределить в столбце
'saveButton' => '.gre-save-btn',

# HTTP метод с помощью которого будет выполнятся сохранение формы
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'POST'
# - Нельзя предопределить в столбце
'saveMethod' => 'POST',

# Битовый флаг режима выбора строк.
#
# В текущей версии поддерживается только EditConfigInterface::SELECT_MODE_CHECKBOX.
# Если включён EditConfigInterface::SELECT_MODE_CHECKBOX, то YourGridView
# должен содержать столбец Kosv\Yii2Grid\RowEditable\Select\CheckboxColumn
# или любой другой столбец с реализацией Kosv\Yii2Grid\RowEditable\Select\CheckboxColumnInterface.
# 
# - Необязательный параметр
# - Тип integer
# - Значение по умолчанию EditConfigInterface::SELECT_MODE_CHECKBOX
# - Нельзя предопределить в столбце
'selectMode' => Kosv\Yii2Grid\RowEditable\Config\EditConfigInterface::SELECT_MODE_CHECKBOX,

# Html класс для блока с выводимыми данными в grid-ячейке
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'output-wrap'
# - Можно предопределить в столбце
'outputWrapHtmlClass' => 'output-wrap',

# Html тег для блока с выводимыми данными в grid-ячейке
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию 'div'
# - Можно предопределить в столбце
'outputWrapHtmlTag' => 'div',

# Html шаблон текста ошибки. Выводится при неудачной валидации, под input'ом
# - Необязательный параметр
# - Тип string
# - Значение по умолчанию '<p>{error}</p>'
# - Можно предопределить в столбце
'validationErrorLayout' => '<p>{error}</p>'

[extension] kosv/yii2-ulogin-widget

$
0
0

Ulogin виджет для yii2

  1. Установка
  2. Как пользоваться

Scrutinizer Code Quality Build Status

Установка

Установку через composer можно выполнить так: `bash composer require kosv/yii2-ulogin-widget или в секцию `require` файла composer.json добавить строку: "kosv/yii2-ulogin-widget": "dev-master" ``

Как пользоваться

О всех параметрах ulogin можно почитать в официальной дакументации

Стандартная конфигурация `php use kosv\ulogin\widget\UloginWidget;

<?php echo UloginWidget::widget([

    'options' => [
      'display' => 'panel',
      'fields' => ['first_name', 'last_name', 'phone'],
      'providers' => ['mailru', 'odnoklassniki', 'vkontakte'],
      'callback' => 'authCallback', //Ваш js callback, который будет вызыватся для отправки данных в контроллер
      'redirect_uri' => '' //При использовании callback, нужно поставить пустую строку
    ],
 ]);

?> `

Стилизация кнопок `php use kosv\ulogin\widget\UloginWidget;

<?php echo UloginWidget::widget([

    'options' => [
      'display' => 'buttons',
      'fields' => ['first_name', 'last_name', 'phone'],
      'providers' => ['mailru', 'odnoklassniki', 'vkontakte'],
      'callback' => 'authCallback', //Ваш js callback, который будет вызыватся для отправки данных в контроллер
      'redirect_uri' => '' //При использовании callback, нужно поставить пустую строку
    ],
    'buttons' => [
        [
          'provider' => 'mailru',
          'layout' => function($data) {
            return ' <img src="mailru.png" ' . $data . '/>';
          }
        ],
        [
          'provider' => 'odnoklassniki',
          'layout' => function($data) {
            return ' <img src="odnoklassniki.png" ' . $data . '/>';
          }
        ],
        [
          'provider' => 'vkontakte',
          'layout' => function($data) {
            return ' <img src="vkontakte.png" ' . $data . '/>';
          }
        ],
    ]
 ]);

?> `

Обработка событий `php <?php echo UloginWidget::widget([

    'options' => [
      'display' => 'panel',
      'fields' => ['first_name', 'last_name', 'phone'],
      'providers' => ['mailru', 'odnoklassniki', 'vkontakte'],
      'callback' => 'authCallback', //Ваш js callback, который будет вызыватся для отправки данных в контроллер
      'redirect_uri' => '' //При использовании callback, нужно поставить пустую строку
    ],
    'eventListeners' => [
      'cloase' => 'closeCallback',
      'open' => 'openCallback',
      'ready' => 'readyCallback',
      ...
    ],
 ]);

?> `

[extension] skeeks/app-basic-smarty

$
0
0

Base app smarty SkeekS CMS (Yii2)

  1. Links
  2. Installation
  3. Video

skeeks!

Latest Stable Version Total Downloads

Links

Installation

# Download latest version of composer
curl -sS https://getcomposer.org/installer | COMPOSER_HOME=.composer php

# Installing the base project SkeekS CMS
COMPOSER_HOME=.composer php composer.phar create-project --prefer-dist --stability=dev skeeks/app-basic-smarty demo.ru
# Going into the project folder
cd demo.ru

# Download latest version of composer
curl -sS https://getcomposer.org/installer | COMPOSER_HOME=.composer php

#Edit the file to access the database, it is located at common/config/db.php

#Update configs
COMPOSER_HOME=.composer php composer.phar self-update && COMPOSER_HOME=.composer php composer.phar du

#Installation of ready-dump
php yii migrate -t=migration_install -p=backup/migrations

Video

Shop on SkeekS CMS (Yii2)

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

[extension] skeeks/yii2-widget-nanogallery

$
0
0

Image gallery for jQuery

  1. Installation
  2. How to use
  3. How to use for SkeekS CMS
  4. Video
  5. Links

nanoGALLERY is a touch enabled and fully responsive image gallery with justified, cascading and grid layout. It supports self hosted images and pulling in Flickr, Google Photos and Google+ photo albums.

nanogallery.brisbois.fr

nanoGALLERY github

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-widget-nanogallery "^0.0.1"

or add

"skeeks/yii2-widget-nanogallery": "^0.0.1"

How to use

<?= \skeeks\yii2\nanogalleryWidget\NanogalleryWidget::widget([
    'items' => [
        [
            'src' => 'https://images.wallpaperscraft.ru/image/leopard_hischnik_morda_oskal_agressiya_58086_1280x720.jpg',
            'preview_src' => 'https://images.wallpaperscraft.ru/image/leopard_hischnik_morda_oskal_agressiya_58086_1280x720.jpg',
            'title' => 'title',
            'description' => 'description',
        ],
        [
            'src' => 'https://s1.1zoom.ru/b5050/261/348938-sepik_2048x1152.jpg',
            'preview_src' => 'https://s1.1zoom.ru/b5050/261/348938-sepik_2048x1152.jpg',
            'title' => 'title',
            'description' => 'description',
        ],
        [
            'src' => 'https://s1.1zoom.ru/big3/297/Canada_Mountains_Scenery_488936.jpg',
            'preview_src' => 'https://s1.1zoom.ru/big3/297/Canada_Mountains_Scenery_488936.jpg',
            'title' => 'title',
            'description' => 'description',
        ]
    ],
    'clientOptions' => [
        'thumbnailHeight' => 500
        
        //all options see http://nanogallery.brisbois.fr/
    ],
]); ?>

How to use for SkeekS CMS


<? 

$tree = \skeeks\cms\models\CmsTree::findOne(10);
$images = $tree->images; 
$items = \yii\helpers\ArrayHelper::map($images, "id", function (\skeeks\cms\models\StorageFile $model) {
    return [
        'src'         => $model->src,
        'preview_src' => \Yii::$app->imaging->thumbnailUrlOnRequest($model->src,
            new \skeeks\cms\components\imaging\filters\Thumbnail([
                'h' => 350,
                'w' => 0,
            ])
        ),
        'description' => $model->name,
        'title'       => $model->name,
    ];
}); 

?>


<?= \skeeks\yii2\nanogalleryWidget\NanogalleryWidget::widget([
    'items' => $items,
    'clientOptions' => [
        'thumbnailHeight' => 200
        
        //all options see http://nanogallery.brisbois.fr/
    ],
]); ?>

Animation
Screenshot1 Screenshot1

Video

Video

Links

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

[extension] alaaaq80/yii2-unifonic

$
0
0

unifonic

The Unifonic integration for the Yii framework

Installation

The preferred way to install this extension is through composer. To install it, either run $ composer require alaaaq80/yii2-unifonic:master-dev or add "alaaaq80/yii2-unifonic":"master-dev" to the require section of your composer.json file.

Usage
use alaaaq80\unifonic\src\API\Client;

   $client = new Client('YOUR_APPSID');
   $client->Messages->Send('00962XXXXX', 'Your Message', 'Sender');

[extension] wadeshuler/yii2-sms

$
0
0

Yii2 SMS

  1. Key take-aways
  2. So how do I use this?
  3. Packages using this library
  4. TODO:
  5. Donate

This is the base library for providing SMS support in your Yii2 application. You can make your own plugins for SMS providers off this base package. It is not to be directly used.

NOTE: You can not use this library/package by itself. It is a parent/root package meant to be extended from! See Yii2 SMS Twilio for an example on how to make your own plugin extending this package.

This is just like the base mail namespace in Yii2. You don't use it directly, but rather use the Swiftmailer package which extends the built-in yii\mail classes.

The goal is to send SMS text messages similar to how you send emails in Yii2 and to be easily extended on to support an infinite number of SMS providers.

Key take-aways

Configuration is in your main config (Advanced: common/config/main-local.php) as the sms component:

'components' => [
    'sms' => [
        'class' => 'namespace\to\ExtendedSms',  // Class that extends BaseSms
        'viewPath' => '@common/sms',            // Optional: defaults to '@app/sms'

        // send all sms to a file by default.
        'useFileTransport' => true,             // false for real sending

        'messageConfig' => [
            'from' => '+15552221234',           // From number to send from
        ],

        'apiKey' => 'xxxxxxxxxxxxxxx',          // Example where to put keys
    ]
]

Note: The above configuration is only an example and will not actually send SMS messages. You will need to make your own Sms class that extends BaseSms, as well as your own class that extends BaseMessage. Your extended classes will handle the logic for using your own SMS service provider of choice. My Yii2 SMS Twilio extension is a great example of how to make a plugin for this package.

When useFileTransport is set to true, it will dump the text messages in the fileTransportPath which defaults to @runtime/sms. I have made slight modifications so these are more readable.

Use the messageConfig array to set default message configurations, such as from, as the Message class will be instantiated with them automatically via the "getters" and "setters", thanks to Yii::createObject().

You can set API key params in the sms configuration array directly, not inside messageConfig, as they have to do with the transport (SMS provider) and not the message specifically. Note: apiKey is not defined in this package, and was simply an example of where to place them.

The viewPath defaults to @app/sms, same as the Yii2 mailer, and can be overridden in the config. This is for using a view file, specified within the compose() function, similar to the Yii2 mailer.

Note: There are only "text" views. Since these are text messages, HTML views are not applicable. Therefore you just pass the view as a string, not an array with a text param in it! I removed that to streamline usage, as it made more sense to take it out.

View file example:
Yii::$app->sms->compose('test-message', ['name' => 'Wade'])

Where test-message is a view file located in the viewPath destination.

View File: common/sms/test-message.php

Hello <?= $name ?> This is a test!

Thanks!

You will need to create the sms directory, as well as the view file, if you intend on using views and not just setting the message directly with setMessage().

Without view file example:
Yii::$app->sms->compose()
    //->setFrom('12345')  // if not set in config, or to override
    ->setTo('+15558881234')
    ->setMessage("Hey {$name} this is a test!\n\nThanks!")
    ->send();

If you set the from number in the main config, under the messageConfig array, you do not need to call setFrom() unless you want to override the number that was configured.

So how do I use this?

I recommend you look at my Yii2 SMS Twilio package. You will see in the composer.json that it requires this package. It's Sms class extends this BaseSms, and Message extends this BaseMessage.

Packages using this library

Want to add yours to the list? Create an issue and I will add it so long as it works and extends this base package.

TODO:

  • Update README
  • Update documentation/commenting
  • Add own logger class

Donate

Please consider donating if you find my code useful.

PayPal Donate


[extension] wadeshuler/yii2-sms-twilio

$
0
0

Yii2 SMS Twilio

  1. Installation
  2. Usage
  3. Determining a successful send
  4. How do I send an image?
  5. Do I have to call setFrom()?
  6. Where can I find error logs?
  7. TODO:
  8. Donate

A Twilio SMS plugin for Yii2 based off my base package, Yii2 SMS, to make sending SMS messages as easy as emails!

Installation

The preferred way to install this extension is through composer

Either run

composer require --prefer-dist wadeshuler/yii2-sms-twilio

or add

"wadeshuler/yii2-sms-twilio": "~1.0"

to the require section of your application's composer.json file.

Then add a new sms component to your main-local.php (advanced) or web.php (basic) like so:

'sms' => [
    'class' => 'wadeshuler\sms\twilio\Sms',

    // Advanced app use '@common/sms', basic use '@app/sms'
    'viewPath' => '@common/sms',     // Optional: defaults to '@app/sms'

    // send all sms to a file by default. You have to set
    // 'useFileTransport' to false and configure the messageConfig['from'],
    // 'sid', and 'token' to send real messages
    'useFileTransport' => true,

    'messageConfig' => [
        'from' => '+15552221234',  // Your Twilio number (full or shortcode)
    ],

    // Find your Account Sid and Auth Token at https://twilio.com/console
    'sid' => 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'token' => 'your_auth_token',

    // Tell Twilio where to POST information about your message.
    // @see https://www.twilio.com/docs/sms/send-messages#monitor-the-status-of-your-message
    //'statusCallback' => 'https://example.com/path/to/callback',      // optional
],

Note: This package does not provide a route for the statusCallback. You will need to create your own route to handle this. It isn't necessary to send SMS messages with Twilio, and is used for deeper tracking of each message's status.

Usage

You can send SMS messages two ways. One uses a view file, just like how the mailer does, by passing it in the compose() call. Only difference is, you don't specify html/text array keys. Just pass the string, since text messages don't use html.

With a view file

In your controller/model use it like so:

Yii::$app->sms->compose('test-message', ['name' => 'Wade'])
    //->setFrom('12345')  // if not set in config, or to override
    ->setTo('+15558881234')
    ->send();

You will need a view file located where your viewPath points to. By default, it is @app/sms. You can see in the configuration above that we overrode it to @common/sms. This is similar to the location Yii2 Advanced uses for the email views, the "common" directory.

View File: common/sms/test-message.php (advanced) or /sms/test-message.php (basic)

Hello <?= $name ?> This is a test!

Thanks!
Without a view file

When sending a large amount of text messages quickly, you may want to skip the view file for performance reasons, or you just may find it overkill for your usage.

$name = "Wade";

Yii::$app->sms->compose()
    //->setFrom('12345')  // optional if set in main config
    ->setTo('+15558881234')
    ->setMessage("Hey {$name} this is a test!")
    ->send();

setMessage() is a nicename function, or alias, for setTextBody(). Since SMS messages only deal with text and not html, I felt this was cleaner. However, setTextBody() will work just the same if your familiar with the way the mailer handles things. Either is fine.

Determining a successful send

A boolean is returned, so it is simple:

$result = Yii::$app->sms->compose()
    ->setTo('+15558881234')
    ->setMessage("Hey {$name} this is a test!")
    ->send();

if ( $result === true ) {
    echo 'SMS was sent!';
} else {
    'Error sending SMS!';
}

How do I send an image?

After your compose() call, use ->setMediaUrl($urlToImage)

Do I have to call setFrom()?

You only have to use setFrom() if you did not specify a from number in the configuration, within the messageConfig array.

If you want to override the from address in your main configuration, then you can call setFrom() specifically.

If you only send from 1 number, just configure it and don't call it directly so you don't have to change it in a bunch of places later.

Tip: If you have multuple numbers, use the Yii2 params array for an all-in-one easy spot to modify the numbers later.

Where can I find error logs?

When an Exception is hit during sending, they will be recorded under @runtime/sms and named according to the type of exception.

TODO:

  • Update README
  • Update documentation/commenting
  • Create Twilio logger component
  • Add support for more Twilio features (messagingServiceSid, channel address, etc)

Donate

Please consider donating if you find my code useful.

PayPal Donate

[extension] phpnt/yii2-cms

$
0
0

Yii2 CMS

  1. Демо Frontend
  2. Демо Backend

Latest Stable Version Total Downloads Latest Unstable Version License

Социальные сети:

Демо Frontend

Демо Backend

Установка
1. composer create-project --prefer-dist phpnt/yii2-cms example
2. php init
3. Файл /common/config/main-local.php - Настройка доступа в БД и отправки почтовых сообщений.
4. yii migrate
Доступы
Админ
Логин: admin@example.ru
Пароль: admin
Редактор
Логин: editor@example.ru
Пароль: editor
Тестировщик
Логин: tester@example.ru
Пароль: tester
Описание
CMS на Yii2 фреймворке Advanced, для создания блогов и интернет магазинов.
Позволяет управлять контентом сайта из backend части приложения и настраивать вывод под индивидуальный дизайн на frontend.
Встроен модуль I18n, позволяющий подключить любые языки и управлять переводом.
Настроен RBAC и управление ролями, разрешениями и правилами.
Подключен Гео модуль, для получения стран, регионов и городов мира, а также информации о них.
Имеется возможность экспорта всей БД в CSV формат и использование его в качестве бекапа.
Подключен файловый менеджер. Пользователь с разрешением ‘main/manage/files-manager’ может управлять сайтом онлайн.
Лицензия:
MIT

[extension] enchikiben/yii2-sitemap

$
0
0

yii2-sitemap

  1. Installation
  2. Configure
  3. Use

Installation

The preferred way to install this extension is through composer.

php composer.phar require --prefer-dist "enchikiben/yii2-sitemap" "*"

or

"enchikiben/yii2-sitemap" : "*"

Configure

'modules' => [
    'sitemap' => [
        'class' => 'enchikiben\sitemap\Sitemap',
        'controllerDirAlias' => '@frontend/controllers'
    ],
],

Add a new rule for urlManager of your application's configuration file, for example:

'urlManager' => [
    'rules' => [
        ['pattern' => 'sitemap', 'route' => 'sitemap/default/index', 'suffix' => '.xml'],
    ],
],

Use

class SiteController extends Base
{

    /**
     * @sitemap priority=1
     */
    public function actionIndex()
    {
    } 

    /**
     * @sitemap priority=0.8
     */
    public function actionConfidentiality()
    {
    }
}

or

class NewsController extends Base
{
    /**
     * @sitemap priority=0.5 changefreq=monthly route=['/news/view','id'=>$model->id] model=common\models\News condition=['status'=>1]
     */
    public function actionView($id)
    {
        
    }
}

[extension] rakhmatov/yii2-payment

$
0
0

payme_01.png logo.png upay_logo_new.png logo.png

Payment module

  1. DIRECTORY STRUCTURE
  2. USAGE

Payment migration module for yii2 Payme.uz Click.uz Upay.uz woy-wo.uz.

Total Downloads Maintainability

Test CoverageDIRECTORY STRUCTURE

components              contains components
controllers             contains controllers which is handles requests
dto                     contains data transfer objects
exeptions
migrations              contains migrations
models

USAGE

add payment module in your configuration file

'modules' => [
    ...
    'payment' => [
        'class' => 'rakhmatov\payment\Module'
    ]
    ...
]

in application params file add `

'paycom' => [
    'login' => 'Paycom',
    'merchat_id' => 'your_merchant_id',
    'key' => 'your_key',
    'test_key' => 'your_test_key',
]


well, now you can check, for example: 
https://example.com/payment/paycom 
or 
https://example.com/payment/click

[extension] pcrt/yii2-select2

$
0
0

Yii2-select2

  1. Installation
  2. Usage
  3. License

Select2 gives you a customizable select box with support for searching, tagging, remote data sets, infinite scrolling, and many other highly used options.

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require pcrt/yii2-select "*"

or add

"pcrt/yii2-select2": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, modify your application configuration to include:

use pcrt\widgets\select2\Select2:


// with \yii\bootstrap\ActiveForm;
echo $form
    ->field($model, 'attribute')
    ->widget(
        Select2::class, 
        [
            'items' => $data, // $data should be the same as the items provided to a regular yii2 dropdownlist
        ]
    );

// as widget
echo Select2::widget([
    'name' => 'my-name',
    'value' => 'my-value',
    'clientOptions' => [
        'maximumInputLength' => 20
    ]
]);

License

Yii2-select2 is released under the BSD-3 License. See the bundled LICENSE.md for details.

Enjoy!

Viewing all 3361 articles
Browse latest View live