July 8

Asynchronous PHP

I stumbled upon this excellent video while searching for React PHP tutorials. It shows implementation of asynchronous processes using curl_multi_exec, pcntl_fork, socket select and many other techniques and libraries. After discussing the pros and cons of each approach it shows proper way of asynchronous implementation using ReactPHP library.

March 25

Smart image field for Yii2

This is replacement of classic file upload HTML form element. Advantages of this field are:
– You don’t have to handle file upload yourself. It is encapsulated in ImageUploadAction.
– ImageUploadAction resolves upload name clashes by default.
– If existing model is edited, image field is pre-populated.
– Uploaded image won’t be lost if form has validation errors after submit.
– There is a delete image link besides upload button.
Installation
The preferred way to install this extension is through composer.
Either run

or add

to the require section of your composer.json file.
Usage
1) Attach ImageUploadAction to designated controller

2) Utilize SmartImageField inside ActiveForm

Screenshot
Screen Shot 2016-02-12 at 3.59.41 PM

Screen Shot 2016-02-12 at 3.59.24 PM
Github
https://github.com/mmedojevicbg/yii2-smart-image-field
Packagist
https://packagist.org/packages/mmedojevicbg/yii2-smart-image-field

Category: PHP | LEAVE A COMMENT
February 9

Textarea with tokens for Yii2

This is drop-in replacement for textarea form element. It provides tokens below form element. Text is automatically inserted into textarea by clicking one of tokens.

Installation
The preferred way to install this extension is through composer.
Either run

or add

to the require section of your composer.json file.

Usage

Screenshot
text-area-tokens

Github
https://github.com/mmedojevicbg/yii2-text-area-tokens

Packagist
https://packagist.org/packages/mmedojevicbg/yii2-text-area-tokens

Category: PHP | LEAVE A COMMENT