[extension] davidjeddy/codeception-hello-module
[extension] davidjeddy/yii2-article-category
[extension] davidjeddy/yii2-freeradius-module
yii2-freeradius-module ¶
Module to interface with a FreeRADIUS server
Badges ¶
REQUIREMENTS ¶
PHP 7+
MySQL 5.5+
FreeRadius
Composer
Yii 2+ (advanced tempplate recommended)
INSTALLATION ¶
cd {project root}
- Run
composer require davidjeddy/yii2-freeradius-module
in terminal- OR add
"davidjeddy/yii2-freeradius-module": "dev-master@dev"
to your project'scomposer.json
, thencomposer install
.
- OR add
USAGE ¶
Add the module to the configuration
return [
...
'modules' => [
...
'free-radius' => [
'class' => davidjeddy\freeradius\Module::class,
],
...
],
];
To add to a typical AdminLTE admin panel:
Edit ./backend/views/layouts/common.php and add the following inside Menu::widget([ ... ])
`
[
'label' => Yii::t('backend', 'Free Radius'),
'icon' => '<i class="fa fa-id-card-o"></i>',
'url' => ['/free-radius/default/index'],
'visible' => Yii::$app->user->can('administrator')
],
# TESTING
TODO
# Misc
If the server does not yet have a `RadCheck` table from FreeRadius, run
the modules migration from the project root:
`php ./console/yii migrate/up --migrationPath=./vendor/davidjeddy/yii2-freeradius-module/migration/`
[extension] davidjeddy/yii2-leaflet-draw-plugin
Leaflet Draw Plugin ¶
Yii 2 LeafletJs Plugin for the 2amigo Leaflet extension that adds the Leaflet Draw functionality.
This Plugin works in conjunction with LeafLet library for Yii 2 framework.
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require "davidjeddy/yii2-leaflet-draw-plugin" "*"
or add
"davidjeddy/yii2-leaflet-draw-plugin" : "*"
to the require section of your application's composer.json
file.
Usage ¶
// first lets setup the center of our map
$center = new \dosamigos\leaflet\types\LatLng(['lat' => 51.508, 'lng' => -0.11]);
// now lets create a marker that we are going to place on our map
$marker = new \dosamigos\leaflet\layers\Marker(['latLng' => $center, 'popupContent' => 'Hi!']);
// The Tile Layer (very important)
$tileLayer = new \dosamigos\leaflet\layers\TileLayer([
'urlTemplate' => 'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg',
'clientOptions' => [
'attribution' => 'Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">, Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
'subdomains' => '1234',
]
]);
// now our component and we are going to configure it
$leaflet = new \dosamigos\leaflet\LeafLet([
'center' => $center, // set the center
]);
// init the 2amigos leaflet plugin provided by the package
$drawFeature = new \davidjeddy\leaflet\plugins\draw\Draw();
// optional config array for leadlet.draw
$drawFeature->options = [
"position" => "topright",
"draw" => [
"polyline" => [
"shapeOptions" => [
"color" => "#ff0000",
"weight" => 10
]
],
"polygon" => [
"allowIntersection" => false, // Restricts shapes to simple polygons
"drawError" => [
"color" => "#e1e100", // Color the shape will turn when intersects
"message" => "<b>Oh snap!</b> you can't draw that!" // Message that will show when intersect
],
"shapeOptions" => [
"color" => "#bada55"
]
],
"circle" => true, // Turns off this drawing tool
"rectangle" => [
"shapeOptions" => [
"clickable" => false
]
]
]
];
// Different layers can be added to our map using the `addLayer` function.
$leaflet->addLayer($marker) // add the marker
->addLayer($tileLayer) // add the tile layer
->installPlugin($drawFeature); // add draw plugin
// we could also do
echo $leaflet->widget(['options' => ['style' => 'min-height: 300px']]);
Testing ¶
TODO
Todo ¶
ADD edit
menu ability
ADD custom marker functionality
Contributing ¶
Please see ./docs/CONTRIBUTING for details.
Credits ¶
License ¶
The BSD License (BSD). Please see ./docs/License File for more information.
Special Thanks ¶
Web development has never been so fun!
http://2amigos.us/
(http://http://sourcetoad.com/)
Sourcetoad is an award winning app development firm based in Tampa, FL. We are specialists in cross-platform web and mobile application development.
http://sourcetoad.com/
[extension] davidjeddy/yii2-paypal
Badges ¶
PayPal extension for the Yii2 ¶
PayPal payment module extension for Yii 2.x
Installation ¶
Add the dependancy to your project via composer (recommended)
composer require --prefer-dist davidjeddy/yii2-paypal "*"
OR"davidjeddy/yii2-paypal": "dev-master"
and runcomposer update
Configuration ¶
'paypal'=> [
'class' => 'davidjeddy\Paypal',
'clientId' => 'you_client_id',
'clientSecret' => 'you_client_secret',
'isProduction' => false,
// These properties would be found in the Paypal sdk_config.ini
'config' => [
'http.ConnectionTimeOut' => 30,
'http.Retry' => 1,
'mode' => \davidjeddy\Paypal::MODE_SANDBOX, // development (sandbox) or production (live) mode
'log.LogEnabled' => YII_DEBUG ? 1 : 0,
'log.FileName' => '@runtime/logs/paypal.log',
'log.LogLevel' => \davidjeddy\Paypal::LOG_LEVEL_FINE,
]
],
Usage ¶
Class Someclass
{
...
/**
* [pay description]
*
* @param array $paramData [description]
* @return [type] [description]
*/
private function pay(array $paramData) {
$paypalComponent = new Paypal();
try {
return $paypalComponent->execTransaction($paramData);
} catch (Exception $ex) {
echo PaypalError($e);
}
return flase;
}
...
}
[extension] davidjeddy/yii2-poll
yii2-poll ¶
Badges ¶
About ¶
Create a basic custom polls for Yii 2.x.
Installing ¶
- Run
composer require davidjeddy/yii2-poll
on the terminal in your {project root}- OR add
"davidjeddy/yii2-poll": "~2"
to your projects composer.json in the "required": [...] section then runcomposer update
.
- OR add
- Run migration via Yii's migration command providing
php ./console/yii migrate/up --migrationPath=./vendor/davidjeddy/yii2-poll/migrations
Usage ¶
Basic:
`
PHP
echo \davidjeddy\poll\PollWidget::widget([
'questionText' => \Yii::t('poll', 'Do you like PHP?'),
'answerOptions' => ['Yes', 'No'],
]);
Advanced:
```PHP
echo \davidjeddy\poll\PollWidget::widget([
'questionText' => \Yii::t('poll', 'Do you like PHP?'),
'answerOptions' => ['Yes', 'No'],
'params' => [
'backgroundLinesColor' => '#DCDCDC',// html hex
'linesColor' => '#DC0079' // html hex
'linesHeight' => 20, // in pixels
'maxLineWidth' => 200, // in pixels
]
]);
[extension] davidjeddy/yii2-rss-reader
Yii2 RSS Reader ¶
RSS reader widget for Yii2.
Badges ¶
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist davidjeddy/yii2-rss-reader "*"
or add
"davidjeddy/yii2-rss-reader": "*"
to the require section of your composer.json
file.
Usage ¶
Once the widget is installed, add it to a view script:
echo \davidjeddy\RssFeed\RssReader::widget([
'channel' => '{source_url}/feed.xml',
'itemView' => 'item',
'pageSize' => 5,
'wrapClass' => 'rss-wrap',
'wrapTag' => 'div',
]);
[extension] rob006/yii2-simple-auth
Simple authentication extension for Yii 2 ¶
Yii 2 extension that provides simple authentication based on a secret key.
The extension provides components for easy authenticate and validate the HTTP request. Each request gets its own unique token with the expiration time, so no passwords or keys are sent with the request - it should be safer than basic access authentication when you don't use https.
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require rob006/yii2-simple-auth
or add
"rob006/yii2-simple-auth": "^1.0"
to the require section of your composer.json
file.
Usage ¶
Configuration ¶
You can configure default secret key used by this extension by setting param in your config in
config/web.php
and/or in config/console.php
:
return [
...
'params' => [
...
'simpleauth' => [
'secret' => 'mysecretkey',
],
],
];
This is optional - you can always explicitly specify the key for authentication/validation.
Authentication (client side) ¶
Authentication when using official yii2-httpclient
extension ¶
You can simply authenticate Request
object from official Yii 2 httpclient
by using yii2-simple-auth-yii-authenticator
extension.
Authentication any request ¶
You can use Authenticator
to authenticate any request, even if you don't use yii2-httpclient
package. For example, authentication cURL request by GET param:
use rob006\simpleauth\Authenticator;
$ch = curl_init();
$url = 'http://api.example.com/user/list/?ids=1,2,3,4';
$url .= '&' . Authenticator::PARAM_NAME . '=' . Authenticator::generateAuthToken($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
Authentication cURL request by header:
`
php
use rob006\simpleauth\Authenticator;
$ch = curl_init(); $url = 'http://api.example.com/user/list/?ids=1,2,3,4'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, [
Authenticator::HEADER_NAME . ': ' . Authenticator::generateAuthToken($url),
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
`
Validation (server side) ¶
To check whether the request has a valid token simply add action filter to your controller:
use rob006\simpleauth\ActionFilter;
class MyController extends \yii\web\Controller {
public function behaviors() {
return [
...
'simpleauth' => [
'class' => ActionFilter::className(),
],
];
}
...
}
You can also configure some settings for ActionFilter
:
use rob006\simpleauth\ActionFilter;
use rob006\simpleauth\Authenticator;
class MyController extends \yii\web\Controller {
public function behaviors() {
return [
...
'simpleauth' => [
'class' => ActionFilter::className(),
// allow authentication only by header
'allowedMethods' => [
Authenticator::METHOD_HEADER,
],
// set token timeout to 1 hour (by default it is 5 minutes)
'tokenDuration' => 3600,
// override default header used for authentication
'headerName' => 'X-My-Custom-Header',
// override params names used for send authentication token
'postParamName' => 'my_custom_token_param_name',
'getParamName' => 'my_custom_token_param_name',
// custom secret used for validate authentication
'secret' => 'my-custom-secret-key',
],
];
}
...
}
Final comments ¶
Make sure that you generate token for final URL and no redirections are performed for the request. Token is generated for the exact address, so tokens for:
http://example.com/user/list/
https://example.com/user/list/
http://www.example.com/user/list/
http://example.com/user/list
will be completely different.
Be careful when using POST request. Authenticator
and ActionFilter
takes into account only the
URL, all POST data is ignored during the authentication and validation. This means that one token
may be used many times for different requests with different POST data if refer to the same URL.
[extension] arm0nd/jfullcalendar
JFullCallendar ¶
[extension] lavrentiev/yii2-toastr
Yii2 - Javascript Toast Notifications ¶
Simple javascript toast notifications - Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.
Установка ¶
Расширение устанавливается с помощью Composer интсрукция по установке Composer
Установка расширения через Composer, выполнить следующую команду:
composer require --prefer-dist lavrentiev/yii2-toastr
или (master)
composer require --prefer-dist lavrentiev/yii2-toastr "dev-master"
или внести изменения в секцию require
в composer.json
и выполнить composer update
"lavrentiev/yii2-toastr": "^2.0"
или (master)
"lavrentiev/yii2-toastr": "dev-master"
Уведомления Notification::widget() ¶
use lavrentiev\widgets\toastr\Notification;
Notification::widget([
'type' => 'info',
'title' => 'Toast Notifications',
'message' => 'Simple javascript toast notifications'
]);
Notification::widget([
'type' => 'error',
'title' => 'Toast Notifications',
'message' => 'Simple javascript toast notifications'
]);
Notification::widget([
'type' => 'success',
'title' => 'Toast Notifications',
'message' => 'Simple javascript toast notifications'
]);
Notification::widget([
'type' => 'warning',
'title' => 'Toast Notifications',
'message' => 'Simple javascript toast notifications'
]);
Notification::widget([
'type' => 'info',
'message' => 'Simple javascript toast notifications'
]);
Notification::widget([
'type' => 'error',
'message' => 'Simple javascript toast notifications'
]);
Notification::widget([
'type' => 'success',
'message' => 'Simple javascript toast notifications'
]);
Notification::widget([
'type' => 'warning',
'message' => 'Simple javascript toast notifications'
]);
Также присутствует возможность настройки произвольного уведомления, по параметрам предусмотренным разработчиками Toastr by CodeSeven
`
php
Notification::widget([
'type' => Notification::TYPE_ERROR,
'title' => 'Toast Notifications',
'message' => 'Simple javascript toast notifications',
'options' => [
"closeButton" => false,
"debug" => false,
"newestOnTop" => false,
"progressBar" => false,
"positionClass" => Notification::POSITION_TOP_RIGHT,
"preventDuplicates" => false,
"onclick" => null,
"showDuration" => "300",
"hideDuration" => "1000",
"timeOut" => "5000",
"extendedTimeOut" => "1000",
"showEasing" => "swing",
"hideEasing" => "linear",
"showMethod" => "fadeIn",
"hideMethod" => "fadeOut"
]
]);
`
Уведомления NotificationFlash::widget() ¶
Подключение осуществляеться глобально допустим в layouts проекта.
<?= \lavrentiev\widgets\toastr\NotificationFlash::widget() ?>
Также присутствует возможность настройки уведомлений, по параметрам предусмотренным разработчиками Toastr by CodeSeven
<?= \lavrentiev\widgets\toastr\NotificationFlash::widget([
'options' => [
"closeButton" => true,
"debug" => false,
"newestOnTop" => false,
"progressBar" => false,
"positionClass" => \lavrentiev\widgets\toastr\NotificationFlash::POSITION_TOP_RIGHT,
"preventDuplicates" => false,
"onclick" => null,
"showDuration" => "300",
"hideDuration" => "1000",
"timeOut" => "5000",
"extendedTimeOut" => "1000",
"showEasing" => "swing",
"hideEasing" => "linear",
"showMethod" => "fadeIn",
"hideMethod" => "fadeOut"
]
]) ?>
\Yii::$app->session->setFlash('error', 'This is the message');
\Yii::$app->session->setFlash('success', 'This is the message');
\Yii::$app->session->setFlash('info', 'This is the message');
\Yii::$app->session->setFlash('warning', 'This is the message');
\Yii::$app->session->setFlash('warning', ['Error 1', 'Error 2', 'Error 3']);
\Yii::$app->session->setFlash('success', ['Error 1', 'Error 2', 'Error 3']);
Допустимые параметры ¶
Параметр | Значение по умолчанию | Допустимые значения | Описание |
---|---|---|---|
type | info | info , error , success , warning | Тип уведомления |
title | --- | --- | Заголовок уведомления |
message | Simple javascript toast notifications | --- | Текст уведомления |
options | [] | Подробней... | Дополнительные опции |
Допустимые константы типов:
TYPE_INFO = 'info'
TYPE_ERROR = 'error'
TYPE_SUCCESS = 'success'
TYPE_WARNING = 'warning'
Допустимые константы положения:
`
POSITION_TOP_RIGHT = 'toast-top-right';
POSITION_TOP_LEFT = 'toast-top-left';
POSITION_TOP_CENTER = 'toast-top-center';
POSITION_TOP_FULL_WIDTH = 'toast-top-full-width';
POSITION_BOTTOM_RIGHT = 'toast-bottom-right';
POSITION_BOTTOM_LEFT = 'toast-bottom-left';
POSITION_BOTTOM_CENTER = 'toast-bottom-center';
POSITION_BOTTOM_FULL_WIDTH = 'toast-bottom-full-width';
`
Демонстрация ¶
- Demo can be found at http://codeseven.github.io/toastr/demo.html
Дополнительно ¶
[extension] light/hashids
Yii2 Hashids
NOTE: The master branch for 2.0 version, that require mini php version is 5.6. You can require light/hashids:^1.0
to use old version.
Installation ¶
Install this package via Composer:
$ composer require light/hashids=^2.0
Usage ¶
configurate is as a component ¶
In your main.php
or web.php
(dependences your yii2 project constructor):
[
'hahsids' => [
'class' => 'light\hashids\Hashids',
//'salt' => 'your salt',
//'minHashLength' => 5,
//'alphabet' => 'abcdefghigk'
]
]
Also using this like this:
$hashids = Yii::createObject([
'class' => 'light\hashids\Hashids'
]);
$id = $hashids->encode(1, 2, 3);
$numbers = $hashids->decode($id);
var_dump($id, $numbers);
Test ¶
$ phpunit
Lisence ¶
[extension] light/yii2-ajaxform
Yii2 Ajax Form
Overview ¶
Using jquery.form
to make ActiveForm
has ability to submit via ajax but not fullpage reload.
Install ¶
Using composer:
$ composer require light/yii2-ajaxform=*
Usage ¶
use light\widgets\ActiveForm;
use yii\web\JsExpression;
ActiveForm::begin([
'ajaxSubmitOptions' => [
'success' => new JsExpression('function(response) {console.log(response)}'),
'complete' => new JsExpression('function() {console.log("request completed.")}')
]
])
Options ¶
- Default enabled
enableAjaxSubmit
is true ajaxSubmitOptions
you can find in jquery.form
Test ¶
$ phpunit
LICENSE ¶
[extension] imanilchaudhari/yii2-social-share
Yii2 social share- A beautiful social share buttons for yii2. ¶
This is a social share buttons for yii2 projects.
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist imanilchaudhari/yii2-social-share "dev-master"
or add
"imanilchaudhari/yii2-social-share": "dev-master"
to the require section of your composer.json
file.
Usage ¶
Once the extension is installed, simply use it in your code by :
<?= \imanilchaudhari\socialshare\ShareButton::widget([
'style'=>'horizontal',
'networks' => ['facebook','googleplus','linkedin','twitter'],
'data_via'=>'imanilchaudhari', //twitter username (for twitter only, if exists else leave empty)
]); ?>
About ¶
This is a replica of SocialShareButton by Yii Expert.
[extension] imanilchaudhari/yii2-currency-converter
Yii2 Currency Converter ¶
- Why Use It
- Important Notice
- Requirements
- Installation
- Usage
- Available Currency Codes
- Contributors
- Open Exchange Rates APi Integration
This extension will help to find out current currency conversion rate. This extension uses Yahoo's currency conversion API.
Why Use It ¶
- Reliable Rate. Uses Yahoo API, Open Exchange Rates API.
- Conversion without curreny code (from country code).
- Caching of rate, to avoid connecting to Yahoo again and again.
Important Notice ¶
As of recent changes on Yahoo Terms of Service. As such, the service is being discontinued. I highly recommend you to use Open Exchange Rates API. As suggested by chaimleich on this pull request. You can find Open Exchnage Rates working example below.
Requirements ¶
- PHP version 5.4 or later
- Curl Extension (Optional)
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist imanilchaudhari/yii2-currency-converter "1.0"
or add
"imanilchaudhari/yii2-currency-converter": "1.0"
to the require section of your composer.json
file.
Usage ¶
Once the extension is installed, simply use it in your code by :
use Yii;
use imanilchaudhari\CurrencyConverter\CurrencyConverter;
$converter = new CurrencyConverter();
$rate = $converter->convert('USD', 'NPR');
print_r($rate); // it will print current Nepalese currency (NPR) rate according to USD
Available Currency Codes ¶
$currencies = [
'AF' => 'AFA',
'AL' => 'ALL',
'DZ' => 'DZD',
'AS' => 'USD',
'AD' => 'EUR',
'AO' => 'AOA',
'AI' => 'XCD',
'AQ' => 'NOK',
'AG' => 'XCD',
'AR' => 'ARA',
'AM' => 'AMD',
'AW' => 'AWG',
'AU' => 'AUD',
'AT' => 'EUR',
'AZ' => 'AZM',
'BS' => 'BSD',
'BH' => 'BHD',
'BD' => 'BDT',
'BB' => 'BBD',
'BY' => 'BYR',
'BE' => 'EUR',
'BZ' => 'BZD',
'BJ' => 'XAF',
'BM' => 'BMD',
'BT' => 'BTN',
'BO' => 'BOB',
'BA' => 'BAM',
'BW' => 'BWP',
'BV' => 'NOK',
'BR' => 'BRL',
'IO' => 'GBP',
'BN' => 'BND',
'BG' => 'BGL',
'BF' => 'XAF',
'BI' => 'BIF',
'KH' => 'KHR',
'CM' => 'XAF',
'CA' => 'CAD',
'CV' => 'CVE',
'KY' => 'KYD',
'CF' => 'XAF',
'TD' => 'XAF',
'CL' => 'CLF',
'CN' => 'CNY',
'CX' => 'AUD',
'CC' => 'AUD',
'CO' => 'COP',
'KM' => 'KMF',
'CD' => 'CDZ',
'CG' => 'XAF',
'CK' => 'NZD',
'CR' => 'CRC',
'HR' => 'HRK',
'CU' => 'CUP',
'CY' => 'EUR',
'CZ' => 'CZK',
'DK' => 'DKK',
'DJ' => 'DJF',
'DM' => 'XCD',
'DO' => 'DOP',
'TP' => 'TPE',
'EC' => 'USD',
'EG' => 'EGP',
'SV' => 'USD',
'GQ' => 'XAF',
'ER' => 'ERN',
'EE' => 'EEK',
'ET' => 'ETB',
'FK' => 'FKP',
'FO' => 'DKK',
'FJ' => 'FJD',
'FI' => 'EUR',
'FR' => 'EUR',
'FX' => 'EUR',
'GF' => 'EUR',
'PF' => 'XPF',
'TF' => 'EUR',
'GA' => 'XAF',
'GM' => 'GMD',
'GE' => 'GEL',
'DE' => 'EUR',
'GH' => 'GHC',
'GI' => 'GIP',
'GR' => 'EUR',
'GL' => 'DKK',
'GD' => 'XCD',
'GP' => 'EUR',
'GU' => 'USD',
'GT' => 'GTQ',
'GN' => 'GNS',
'GW' => 'GWP',
'GY' => 'GYD',
'HT' => 'HTG',
'HM' => 'AUD',
'VA' => 'EUR',
'HN' => 'HNL',
'HK' => 'HKD',
'HU' => 'HUF',
'IS' => 'ISK',
'IN' => 'INR',
'ID' => 'IDR',
'IR' => 'IRR',
'IQ' => 'IQD',
'IE' => 'EUR',
'IL' => 'ILS',
'IT' => 'EUR',
'CI' => 'XAF',
'JM' => 'JMD',
'JP' => 'JPY',
'JO' => 'JOD',
'KZ' => 'KZT',
'KE' => 'KES',
'KI' => 'AUD',
'KP' => 'KPW',
'KR' => 'KRW',
'KW' => 'KWD',
'KG' => 'KGS',
'LA' => 'LAK',
'LV' => 'LVL',
'LB' => 'LBP',
'LS' => 'LSL',
'LR' => 'LRD',
'LY' => 'LYD',
'LI' => 'CHF',
'LT' => 'EUR',
'LU' => 'EUR',
'MO' => 'MOP',
'MK' => 'MKD',
'MG' => 'MGF',
'MW' => 'MWK',
'MY' => 'MYR',
'MV' => 'MVR',
'ML' => 'XAF',
'MT' => 'EUR',
'MH' => 'USD',
'MQ' => 'EUR',
'MR' => 'MRO',
'MU' => 'MUR',
'YT' => 'EUR',
'MX' => 'MXN',
'FM' => 'USD',
'MD' => 'MDL',
'MC' => 'EUR',
'MN' => 'MNT',
'MS' => 'XCD',
'MA' => 'MAD',
'MZ' => 'MZM',
'MM' => 'MMK',
'NA' => 'NAD',
'NR' => 'AUD',
'NP' => 'NPR',
'NL' => 'EUR',
'AN' => 'ANG',
'NC' => 'XPF',
'NZ' => 'NZD',
'NI' => 'NIC',
'NE' => 'XOF',
'NG' => 'NGN',
'NU' => 'NZD',
'NF' => 'AUD',
'MP' => 'USD',
'NO' => 'NOK',
'OM' => 'OMR',
'PK' => 'PKR',
'PW' => 'USD',
'PA' => 'PAB',
'PG' => 'PGK',
'PY' => 'PYG',
'PE' => 'PEI',
'PH' => 'PHP',
'PN' => 'NZD',
'PL' => 'PLN',
'PT' => 'EUR',
'PR' => 'USD',
'QA' => 'QAR',
'RE' => 'EUR',
'RO' => 'ROL',
'RU' => 'RUB',
'RW' => 'RWF',
'KN' => 'XCD',
'LC' => 'XCD',
'VC' => 'XCD',
'WS' => 'WST',
'SM' => 'EUR',
'ST' => 'STD',
'SA' => 'SAR',
'SN' => 'XOF',
'CS' => 'EUR',
'SC' => 'SCR',
'SL' => 'SLL',
'SG' => 'SGD',
'SK' => 'EUR',
'SI' => 'EUR',
'SB' => 'SBD',
'SO' => 'SOS',
'ZA' => 'ZAR',
'GS' => 'GBP',
'ES' => 'EUR',
'LK' => 'LKR',
'SH' => 'SHP',
'PM' => 'EUR',
'SD' => 'SDG',
'SR' => 'SRG',
'SJ' => 'NOK',
'SZ' => 'SZL',
'SE' => 'SEK',
'CH' => 'CHF',
'SY' => 'SYP',
'TW' => 'TWD',
'TJ' => 'TJR',
'TZ' => 'TZS',
'TH' => 'THB',
'TG' => 'XAF',
'TK' => 'NZD',
'TO' => 'TOP',
'TT' => 'TTD',
'TN' => 'TND',
'TR' => 'TRY',
'TM' => 'TMM',
'TC' => 'USD',
'TV' => 'AUD',
'UG' => 'UGS',
'UA' => 'UAH',
'SU' => 'SUR',
'AE' => 'AED',
'GB' => 'GBP',
'US' => 'USD',
'UM' => 'USD',
'UY' => 'UYU',
'UZ' => 'UZS',
'VU' => 'VUV',
'VE' => 'VEF',
'VN' => 'VND',
'VG' => 'USD',
'VI' => 'USD',
'WF' => 'XPF',
'XO' => 'XOF',
'EH' => 'MAD',
'ZM' => 'ZMK',
'ZW' => 'USD'
];
Contributors ¶
Open Exchange Rates APi Integration ¶
Here is a code snippets suggested by chaimleich on this pull request.
`
php
use Yii; use imanilchaudhari\CurrencyConverter\Provider\OpenExchangeRatesApi;
class CurrencyConverter extends \imanilchaudhari\CurrencyConverter\CurrencyConverter {
/**
* @inheritdoc
*/
public function getRateProvider()
{
if (!$this->rateProvider) {
$this->setRateProvider(new OpenExchangeRatesApi([
'appId' => Yii::$app->params['openExchangeRate']['appId'],
]));
}
return $this->rateProvider;
}
}
`
[extension] yii-elastic-search
It is an yii-1.x extension for performing ElasticSearch queries. This extension is based on Official low-level client for ElasticSearch
Requirements ¶
- PHP 7.0 or higher
Installation ¶
- Download the extension
- Copy elasticSearch extension to your project extension direcory
- Add components to main.php
'es' => [
'class' => 'application.extensions.elasticSearch.ElasticSearch',
'host' => '127.0.0.1:9200',
// Array of index types. Array keys indicate the name of indexes
'es_index_type' => [
'my_index' => 'my_type',
'my_index2' => 'my_type2',
'my_index3' => 'my_type2',
// list all indexes and types [key value pare]
]
]
Usage ¶
Query by ID
$response = Yii::app()->es->getById('my_index', 'my_id');
Output look like
Array
(
[_index] => my_index
[_type] => my_type
[_id] => my_id
[_version] => 1
[found] => 1
[_source] => Array
(
[id] => my_id
.....
)
)
Get by query
$queryBody = [];
$queryBody['_source'] = 'field1, field2, field3'; // An example of selected fields
$queryBody['body'] = [
'query' => [
'bool' => [
'must' => [
'bool' => [
'should' => [
[ 'match' => [ 'condition_field_name' => "condition_value" ] ]
]
]
]
]
]
];
$response = Yii::app()->es->getByQuery('my_index', $queryBody);
Query as per official documentation
$params = [
'index' => 'my_index',
'type' => 'my_type',
'id' => 'my_id'
];
$response = Yii::app()->es->getClientInstance()->get($params);
Resources ¶
[extension] chiliec/yii2-vote
Vote for Yii2 ¶
- Installation
- Documentation
- List of contributors
- Other vote solutions for Yii2
- Articles and tutorials
- Usage examples
- License
- How to contribute
Installation ¶
Next steps will guide you through the process of installing yii2-vote using composer. Installation is a quick and easy three-step process.
Step 1: Install component via composer ¶
Run command
php composer.phar require --prefer-dist chiliec/yii2-vote "^4.1"
or add
"chiliec/yii2-vote": "^4.1"
to the require section of your composer.json
file.
Step 2: Configuring your application ¶
Add following lines to your main configuration file:
'bootstrap' => [
'chiliec\vote\components\VoteBootstrap',
],
'modules' => [
'vote' => [
'class' => 'chiliec\vote\Module',
// show messages in popover
'popOverEnabled' => true,
// global values for all models
// 'allowGuests' => true,
// 'allowChangeVote' => true,
'models' => [
// example declaration of models
// \common\models\Post::className(),
// 'backend\models\Post',
// 2 => 'frontend\models\Story',
// 3 => [
// 'modelName' => \backend\models\Mail::className(),
// you can rewrite global values for specific model
// 'allowGuests' => false,
// 'allowChangeVote' => false,
// ],
],
],
],
And add widget in view:
<?php echo \chiliec\vote\widgets\Vote::widget([
'model' => $model,
// optional fields
// 'showAggregateRating' => true,
]); ?>
Also you can add widget for display top rated models:
<?php echo \chiliec\vote\widgets\TopRated::widget([
'modelName' => \common\models\Post::className(),
'title' => 'Top rated models',
'path' => 'site/view',
'limit' => 10,
'titleField' => 'title',
]) ?>
Step 3: Updating database schema ¶
After you downloaded and configured Yii2-vote, the last thing you need to do is updating your database schema by applying the migrations:
$ php yii migrate/up --migrationPath=@vendor/chiliec/yii2-vote/migrations
Documentation ¶
Extended information about configuration of this module see in docs/README.md. There you can find:
- Migration from 2.* to 3.0
- Manually add behavior in models
- Sorting by rating in data provider
- Overriding views
- Customizing JS-events
- Rich snippet in search engines
List of contributors ¶
- Chiliec - Maintainer
- loveorigami - Ideological inspirer
- fourclub - PK name fix in behavior
- yurkinx - Duplication js render fix
- n1k88 - German translation
- teranchristian - Add popover to display messages
- Skatox - Add support for PostgreSQL
Other vote solutions for Yii2 ¶
- yii2-vote by hauntd - it allows you to attach vote widgets, like and favorite buttons to your models
- yii2-vote by bigdropinc - another solution with same name
Articles and tutorials ¶
Usage examples ¶
- Your site could be the first in this list
License ¶
yii2-vote is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.
How to contribute ¶
See CONTRIBUTING.md for details.
Enjoy and don't hesitate to send issues and pull requests :)
[extension] cozumel/yii2-twemoji
Yii2 Twemoji ¶
A simple way to add Twemoji support to your Yii2 project.
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist cozumel/yii2-twemoji "*"
or add
"cozumel/yii2-twemoji": "*"
to the require section of your composer.json
file.
Usage ¶
Once the extension is installed, simply use it in your code by :
use cozumel\twemoji\TwemojiAsset;
TwemojiAsset::register($this);
CSS ¶
Because every project will have different size requirements, the css is not part of the extension.
The default size of the emojis is 72x72. You can change this easily with some css.
`
css
img.emoji {
height: 1em;
width: 1em;
margin: 0 .05em 0 .1em;
vertical-align: -0.1em;
}
`
[news] MongoDB extension 2.1.7 released
We are very pleased to announce the release of MongoDB extension version 2.1.7 that fixes Yii 2.0.14+ incompatibility and enhances Session component error reporting.
[news] Smarty extension 2.0.7 released
We are very pleased to announce the release of Smarty extension version 2.0.7 that fixes widget registration and rendering code generation inside subtemplates and adds an ability to use SmartyBC
class.
[news] Swiftmailer extension 2.1.1 released
We are very pleased to announce the release of Swiftmailer extension version 2.1.1 that fixes yii\swiftmailer\Mailer::setTransport
had no effect after sending of first message.