PHP code example of amjadiqbal / alertify

1. Go to this page and download the library: Download amjadiqbal/alertify 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/ */

    

amjadiqbal / alertify example snippets


'providers' => [
    // ...
    AmjadIqbal\Alertify\Providers\AlertifyServiceProvider::class,
],

return [
    'default' => [
        'title'             => [],
        'text'              => [],
        'timer'             => env('ALERTIFY_TIMER'),
        'width'             => env('ALERTIFY_WIDTH'),
        'heightAuto'        => env('ALERTIFY_HEIGHT_AUTO'),
        'padding'           => env('ALERTIFY_PADDING'),
        'animation'         => env('ALERTIFY_ANIMATION'),
        'showConfirmButton' => env('ALERTIFY_SHOW_CONFIRM_BUTTON'),
        'showCloseButton'   => env('ALERTIFY_CLOSE_BUTTON'),
    ],

    'middleware' => [
        'title'               => '',
        'text'                => '',
        'type'                => '',
        'html'                => '',
        'toast'               => '',
        'position'            => '',
        'width'               => '',
        'showConfirmButton'   => '',
        'showCloseButton'     => '',
    ]
];

// Display a simple alert
alert(['title' => 'Hello!', 'text' => 'Welcome to Alertify', 'type' => 'success']);

// Display an alert with more options
alert([
    'title' => 'Oops...', 
    'text' => 'Something went wrong!', 
    'type' => 'error',
    'timer' => 3000,
    'showCloseButton' => true
]);

public function store(Request $request)
{
    // Process the request...
    
    // Display a success message
    alert([
        'title' => 'Success!',
        'text' => 'Your data has been saved.',
        'type' => 'success'
    ]);
    
    return redirect()->back();
}

protected $middlewareGroups = [
    'web' => [
        // ...
        \AmjadIqbal\Alertify\Core\Alertify::class,
    ],
];

$request->session()->flash('title', 'Success!');
$request->session()->flash('text', 'Operation completed successfully.');
$request->session()->flash('type', 'success');
bash
php artisan vendor:publish --provider="AmjadIqbal\Alertify\Providers\AlertifyServiceProvider"