diff --git a/docs/_data/manifest.json b/docs/_data/manifest.json index 29c28bb1..ebbc3fdc 100644 --- a/docs/_data/manifest.json +++ b/docs/_data/manifest.json @@ -1,5 +1,5 @@ { - "dist/main.css": "/dist/main.bc57507d.css", + "dist/main.css": "/dist/main.cea611bb.css", "dist/main.js": "/dist/main.8b056786.js", "dist/455.3a7b4474.css": "/dist/455.3a7b4474.css", "dist/455.095e6545.js": "/dist/455.095e6545.js", diff --git a/docs/_posts/2025-03-30-integrating-phpflasher-with-laravel.html b/docs/_posts/2025-03-30-integrating-phpflasher-with-laravel.html index abdfafb4..ed0c9557 100644 --- a/docs/_posts/2025-03-30-integrating-phpflasher-with-laravel.html +++ b/docs/_posts/2025-03-30-integrating-phpflasher-with-laravel.html @@ -4,7 +4,7 @@ title: "Integrating PHPFlasher with Laravel: A Complete Guide for Beginners" date: 2025-03-30 04:09:31 author: yoeunes github_username: yoeunes -twitter_username: yoeunes_en +twitter_username: yoeunes linkedin_username: younes--ennaji author_bio: "Creator and maintainer of PHPFlasher. Passionate about building elegant and intuitive PHP libraries that improve developer experience." tags: [laravel, tutorial, beginner] @@ -14,9 +14,121 @@ reading_time: 10 featured: true --- +
+

Laravel vs. PHPFlasher

+
+
+

+ Laravel +

+
+
+
+
+
+
+
+
https://example.com/users
+
+ + +
+
+
+
+ User updated successfully! +
+ +
+
+
+
+
+
+
+
+
+
+
    +
  • + + Static alert takes up valuable page space +
  • +
  • + + Requires manual template implementation +
  • +
  • + + No auto-dismissal functionality +
  • +
+
+ +
+

+ PHPFlasher +

+
+
+
+
+
+
+
+
https://example.com/users
+
+ + +
+
+
+ +
+
+
+
+ +
+
User updated successfully!
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
    +
  • + + Elegant toast notification that preserves layout +
  • +
  • + + Zero template modifications required +
  • +
  • + + Auto-dismissal with visual countdown +
  • +
+
+
+
+

- Laravel is one of the most popular PHP frameworks, known for its elegant syntax and developer-friendly features. Adding flash notifications to your Laravel application becomes incredibly straightforward with PHPFlasher. In this complete guide, you'll learn everything you need to know to get started with PHPFlasher v2 in your Laravel projects.

@@ -68,11 +180,11 @@ featured: true

- Why Developers Love It + Why Developers Love It

@@ -123,46 +235,45 @@ featured: true -

Installation

+
+

Getting Started in Seconds

-

First, install PHPFlasher using Composer. The process is extremely simple:

+

First, install PHPFlasher using Composer. The process is extremely simple:

-
-
-
Terminal
-
-
-
-
+
+
+
Terminal
+
+
+
+
+
+
+
composer require php-flasher/flasher-laravel
+
+ +
+ +
+

Zero Configuration

+

+ That's it! No service provider registration, no publishing assets, no template modifications. PHPFlasher v2 auto-registers and injects everything you need. +

-
composer require php-flasher/flasher-laravel
-
-
- -
-

No configuration needed!

-

- The service provider will be automatically registered through Laravel's package discovery. You're ready to go without any additional setup. PHPFlasher v2 automatically injects all necessary assets. -

-
-
+

Now you can create beautiful notifications with a single line of code:

-

Basic Usage

- -

Once installed, you can immediately start using PHPFlasher in your controllers with a single line of code. Here's a simple example:

- -
-
-
app/Http/Controllers/UserController.php
-
-
-
-
+
+
+
app/Http/Controllers/UserController.php
+
+
+
+
+
-
-
// In your controller
+        
// In your controller
 public function store(Request $request)
 {
     // Process the form submission
@@ -173,6 +284,7 @@ public function store(Request $request)
 
     return redirect()->route('users.index');
 }
+
@@ -192,9 +304,9 @@ public function store(Request $request)
-

+

Traditional Laravel Flash -

+

In your controller:

@@ -210,7 +322,7 @@ public function update(Request $request, $id) return redirect()->route('users.index'); }
-

In your Blade template:

+

In your Blade template:

@if (session('message'))
     <div class="alert alert-{{ session('alert-type') ?? 'info' }}">
         {{ session('message') }}
@@ -221,9 +333,9 @@ public function update(Request $request, $id)
 
     
-

+

With PHPFlasher -

+

In your controller:

@@ -238,131 +350,12 @@ public function update(Request $request, $id) return redirect()->route('users.index'); }
-

In your Blade template:

+

In your Blade template:

// Nothing needed! PHPFlasher v2 auto-injects everything
-
-

Results Comparison

-
-
-

- Traditional Result -

-
-
-
-
-
-
-
-
https://example.com/users
-
- - -
-
-
-
- User updated successfully! -
- -
-
-
-
-
-
-
-
-
-
-
    -
  • - - Static alert that doesn't disappear -
  • -
  • - - Takes up permanent space in your layout -
  • -
  • - - Basic styling with limited customization -
  • -
-
- -
-

- PHPFlasher Result -

-
-
-
-
-
-
-
-
https://example.com/users
-
- - -
-
-
- -
-
-
-
Success
- -
-
-
- -
-
User updated successfully!
-
-
-
-
-
-
- - -
-
-
-
-
-
-
-
-
-
-
    -
  • - - Toast notification with auto-dismiss -
  • -
  • - - Doesn't interfere with page layout -
  • -
  • - - Beautiful styling with animations -
  • -
-
-
-
-