YII2 Gridview limiting number rows per page

Using GridView::widget the default number of rows per page is 20. This can be adjusted. This is done when defining the dataProvider.

In the search model, modify dataProvider as follows:

  1. $dataProvider = new ActiveDataProvider([
  2.     'query' => $query,
  3.     'pagination' => [
  4.         'pageSize' => 50,
  5.     ],
  6. ]);

This will set the number of rows per page to 50.

Send e-mail from YII2 using PHP mail

To enable sending mail from your YII2 application using PHP mail function, make the following adjustment in the YII2 config file.

Find the following:

  1. 'mailer' => [
  2.             'class' => 'yii\swiftmailer\Mailer',
  3.             'viewPath' => '@common/mail',
  4.             // send all mails to a file by default. You have to set
  5.             // 'useFileTransport' to false and configure a transport
  6.             // for the mailer to send real emails.
  7.             'useFileTransport' => true,
  8.         ],

This will be under the components parameters in the config. If using advanced YII2 instance, the file will be in common/main-local.php by default.

Change the code to this:

  1. return [
  2.     'components' => [
  3.         ...
  4.         'mailer' => [
  5.             'class' => 'yii\swiftmailer\Mailer',
  6.             'viewPath' => '@common/mail',
  7.             'transport' => [
  8.                 'class' => 'Swift_MailTransport',
  9.             ],
  10.             'useFileTransport' => false,
  11.         ],
  12.  
  13.     ],
  14. ];

useFileTransport must be changed to false and transport is set to use Swift_MailTransport.

See the following site for info on swiftmailer transport types.

http://swiftmailer.org/docs/sending.html#using-the-mail-transport