1. Go to this page and download the library: Download kevsuarez/livewire-notiflix library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/*
* @param1 {String}: Optional, type text in String format.
* -> Supported values:
* • success
* • info
* • warning
* • error
* • failure
*
* -> Default value: 'success'
*
* @param2 {String}: Optional, message text in String format.
* -> Default value: 'Message'
*
* @param3 {Array}: Optional, extend the initialize options with new options and the callback for each notification element.
* -> Default value: []
*
* @param4 {Bool}: Optional, enable the callback that is triggered when the notification element has been clicked.
-> Default value: false
*/
/*
* @param1 {String}: Optional, title text in String format.
* -> Default value: 'Title'
*
* @param2 {String}: Optional, message text in String format.
* -> Default value: 'Message'
*
* @param3 {String}: Optional, confirm button text in String format.
* -> Default value: 'Confirm'
*
* @param4 {String}: Optional, cancel button text in String format.
* -> Default value: 'Cancel'
*
* @param5 {Array}: Optional, extend the initialize options with new options and the callbacks for each confirm box.
* -> Default value: []
*/
public function confirmed($params)
{
$this->notify(
'success',
'Thanks! consider giving it a star on github.'
);
}
public function cancelled()
{
$this->notify(
'info',
'Understood',
);
}
public function triggerConfirm()
{
$title = 'Livewire Notiflix';
$message = 'Do you love Livewire Notiflix?';
$confirmButtonText = 'Yes';
$cancelButtonText = 'Nope';
$options = [
'onConfirmed' => 'onConfirmed',
'onCancelled' => 'onCancelled',
//You can pass the value as an argument to the confirm method, if you want.
'params' => 'Thanks! for choose Livewire Notiflix.',
];
$this->confirm($title, $message, $confirmButtonText, $cancelButtonText, $options);
}
/*
* @param1 {String}: Optional, title text in String format.
* -> Default value: 'Title'
*
* @param2 {String}: Optional, question text in String format.
* -> Default value: 'Question'
*
* @param3 {String}: Optional, answer text in String format.
* -> Default value: 'Answer'
*
* @param4 {String}: Optional, answer button text in String format.
* -> Default value: 'Answer'
*
* @param5 {String}: Optional, cancel button text in String format.
* -> Default value: 'Cancel'
*
* @param6 {Array}: Optional, extend the initialize options with new options and the callbacks for each confirm box.
* -> Default value: []
*/
public function onAskConfirmed($params)
{
$this->notify(
'success',
'Thanks! consider giving it a star on github.'
);
}
public function onAskCancelled()
{
$this->notify(
'info',
'Understood',
);
}
public function triggerAsk()
{
$title = 'Livewire Notiflix';
$question = 'Do you love Livewire Notiflix?';
$answer = 'Yes';
$answerButtonText = 'Answer';
$cancelButtonText = 'Cancel';
$options = [
'onAskConfirmed' => 'onAskConfirmed',
'onAskCancelled' => 'onAskCancelled',
//You can pass the value as an argument to the onAskConfirmed method, if you want.
'params' => 'Thanks! for choose Livewire Notiflix.',
];
$this->ask($title, $question, $answer, $answerButtonText, $cancelButtonText, $options);
}