PHP code example of rayhan-bapari / notyfyre

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

    

rayhan-bapari / notyfyre example snippets




namespace App\Http\Controllers;

use Illuminate\Http\Controller;

class ExampleController extends Controller
{
    public function store()
    {
        // Using the helper function (only title needed)
        notyfyre()->success('User created successfully!');

        // Or using the Facade
        \Notyfyre::error('Something went wrong!');

        // Different notification types
        notyfyre()->info('Information message');
        notyfyre()->warning('Warning message');
        notyfyre()->error('Error message');
        notyfyre()->success('Success message');

        // With custom options
        notyfyre()->success('Custom notification', [
            'position' => 'bottom-right',
            'autoClose' => 5000,
            'progress' => false
        ]);

        return redirect()->back();
    }
}

return [
    'position' => 'top-center',
    'auto_close' => 3000, // milliseconds, false to disable
    'progress' => true, // Progress bar at bottom
    '

notyfyre()
    ->success('First notification')
    ->error('Second notification')
    ->info('Third notification');

notyfyre()->success('Message', [
    'position' => 'bottom-left',
    'autoClose' => 5000,
    'progress' => false
]);

// Basic methods (title only)
notyfyre()->success($title, $options = [])
notyfyre()->error($title, $options = [])
notyfyre()->warning($title, $options = [])
notyfyre()->info($title, $options = [])

// Utility methods
notyfyre()->getNotifications() // Get all notifications
notyfyre()->clear() // Clear all notifications
notyfyre()->getAndClear() // Get and clear notifications
notyfyre()->setDefaults($options) // Set default options

   // Old (v1.x)
   notyfyre()->success('Message', 'Title');

   // New (v2.x)
   notyfyre()->success('Title');
   
bash
php artisan vendor:publish --provider="RayhanBapari\Notyfyre\NotyfyreServiceProvider" --tag="notyfyre-config"
bash
php artisan vendor:publish --provider="RayhanBapari\Notyfyre\NotyfyreServiceProvider" --tag="notyfyre-assets"
bash
php artisan vendor:publish --provider="RayhanBapari\Notyfyre\NotyfyreServiceProvider" --tag="notyfyre-views"