rzlco666/notifikasi

Apple-inspired liquid glass notifications for PHP and Laravel

0.3.1 2025-07-09 17:58 UTC

This package is auto-updated.

Last update: 2025-07-09 18:02:18 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads PHP Version License

The Most Advanced Notification System for PHP & Laravel
Bringing Apple's Design Philosophy to Web Development

๐Ÿš€ Installation โ€ข ๐Ÿ“– Quick Start โ€ข ๐ŸŽฏ Features โ€ข ๐Ÿ“š Documentation โ€ข ๐Ÿ› ๏ธ Advanced Usage

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Features

๐ŸŽ Apple Design System

Built following Apple's Human Interface Guidelines with pixel-perfect attention to detail.

  • Liquid Glass Effect - Modern backdrop blur with transparency layers
  • Dynamic Typography - SF Pro-inspired font system with perfect scaling
  • Spatial Audio - Web Audio API integration with harmonic frequencies
  • Motion Design - Physics-based animations with spring curves

โšก Performance First

Engineered for speed and efficiency in production environments.

  • Zero Dependencies - Pure PHP with no external libraries
  • Hardware Acceleration - CSS transforms and RequestAnimationFrame
  • Memory Efficient - Automatic cleanup and garbage collection
  • Bundle Size - < 50KB total footprint including all assets

๐Ÿ”ง Developer Experience

Designed by developers, for developers with modern best practices.

  • Type Safety - Full PHP 8.2+ type declarations and enums
  • Fluent API - Chainable methods with intuitive naming
  • Auto-completion - Rich IDE support with comprehensive docblocks
  • Error Handling - Graceful degradation with detailed error messages

๐ŸŒ Universal Compatibility

Works everywhere your PHP application runs.

  • Framework Agnostic - Laravel, Symfony, CodeIgniter, or pure PHP
  • Storage Drivers - Session, Array, Database (coming soon)
  • Browser Support - Chrome 58+, Firefox 53+, Safari 10+, Edge 79+
  • Mobile Ready - PWA compatible with native-like experience

๐Ÿ—๏ธ Architecture

๐ŸŽฏ Vision

To create the most beautiful, performant, and developer-friendly notification system that brings native app-quality experiences to web applications.

๐Ÿ›๏ธ Core Principles

  1. Design Excellence - Every pixel matters, every animation serves a purpose
  2. Performance First - Fast by default, optimized for scale
  3. Accessibility - Inclusive design for all users and devices
  4. Developer Joy - Simple APIs that make complex things easy

๐Ÿ“ System Design

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Notifikasi                  โ”‚
โ”‚               Core Engine                   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  NotifikasiInterface  โ”‚  StorageInterface   โ”‚
โ”‚                      โ”‚                     โ”‚
โ”‚  โ”œโ”€ success()        โ”‚  โ”œโ”€ SessionStorage  โ”‚
โ”‚  โ”œโ”€ error()          โ”‚  โ”œโ”€ ArrayStorage    โ”‚
โ”‚  โ”œโ”€ warning()        โ”‚  โ””โ”€ DatabaseStorage โ”‚
โ”‚  โ””โ”€ info()           โ”‚     (coming soon)   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚              Notification                   โ”‚
โ”‚          Individual Instance                โ”‚
โ”‚                                             โ”‚
โ”‚  โ”œโ”€ Level (Enum)                           โ”‚
โ”‚  โ”œโ”€ Title & Message                        โ”‚
โ”‚  โ”œโ”€ Options & Metadata                     โ”‚
โ”‚  โ””โ”€ Timestamp & ID                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚            Rendering Engine                 โ”‚
โ”‚                                             โ”‚
โ”‚  โ”œโ”€ HTML Structure                         โ”‚
โ”‚  โ”œโ”€ CSS Generation                         โ”‚
โ”‚  โ”œโ”€ JavaScript Controller                  โ”‚
โ”‚  โ””โ”€ Theme System                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โšก Installation

๐Ÿ“‹ Requirements

  • PHP: 8.2 or higher
  • Laravel: 12.0+ (for Laravel integration)
  • Extensions: json, session (built-in)

๐ŸŽฏ Quick Install

composer require rzlco666/notifikasi

๐Ÿ”ง Laravel Setup

The package auto-registers itself, but you can publish configuration:

# Publish configuration file
php artisan vendor:publish --provider="Rzlco\Notifikasi\NotifikasiServiceProvider" --tag="config"

# Publish views (optional)
php artisan vendor:publish --provider="Rzlco\Notifikasi\NotifikasiServiceProvider" --tag="views"

๐ŸŒ PHP Native Setup

<?php
require_once 'vendor/autoload.php';

use Rzlco\Notifikasi\Notifikasi;
use Rzlco\Notifikasi\Storage\SessionStorage;

// Initialize
$notifikasi = new Notifikasi(new SessionStorage());

๐Ÿ“– Quick Start

โšก 5-Minute Setup

1. Add to your layout:

{{-- Laravel Blade --}}
<!DOCTYPE html>
<html>
<head>
    <title>Your App</title>
</head>
<body>
    <!-- Your content -->
    
    {{-- Add notification renderer at end of body --}}
    {!! app('notifikasi')->render() !!}
</body>
</html>

2. Create notifications:

// In your controller
use Rzlco\Notifikasi\Facades\Notifikasi;

class UserController extends Controller
{
    public function store(Request $request)
    {
        // Your logic here...
        
        Notifikasi::success('User Created!', 'The user has been successfully created.');
        
        return redirect()->back();
    }
}

3. See it in action! ๐ŸŽ‰

Your notifications will appear with beautiful liquid glass effects, complete with sound and animations.

๐ŸŽจ Visual Examples

// Success notification
Notifikasi::success('Payment Successful', 'Your order #12345 has been processed.');

// Error with custom duration
Notifikasi::error('Payment Failed', 'Please check your card details.', [
    'duration' => 8000
]);

// Info with custom positioning
Notifikasi::info('New Feature', 'Check out our new dashboard!', [
    'position' => 'bottom-left'
]);

// Warning without auto-dismiss
Notifikasi::warning('Session Expiring', 'Your session will expire in 5 minutes.', [
    'auto_dismiss' => false
]);

๐ŸŽจ Basic Usage

๐Ÿš€ Core Methods

use Rzlco\Notifikasi\Facades\Notifikasi;

// Basic notifications
Notifikasi::success($title, $message);
Notifikasi::error($title, $message);
Notifikasi::warning($title, $message);
Notifikasi::info($title, $message);

// With custom options
Notifikasi::success('Title', 'Message', [
    'duration' => 3000,
    'position' => 'top-left',
    'theme' => 'dark',
    'sound' => false
]);

๐ŸŽ›๏ธ Available Options

Option Type Default Description
duration int 5000 Auto-dismiss time in milliseconds
position string 'top-right' Position: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right
theme string 'auto' Theme: auto, light, dark
sound bool true Enable sound effects
closable bool true Show close button
show_time bool true Display timestamp
time_format string '12' Time format: 12 or 24
auto_dismiss bool true Auto-dismiss after duration

๐Ÿ”„ Fluent Interface

$notifikasi = new Notifikasi(new ArrayStorage());

$notifikasi
    ->success('Data Saved', 'Your changes have been saved.')
    ->info('Sync Started', 'Synchronizing with server...')
    ->warning('Quota Low', 'You have 10% storage remaining.')
    ->render();

๐Ÿ”ง Laravel Integration

๐ŸŽฏ Service Provider Registration

The package automatically registers itself, providing:

  • NotifikasiInterface binding
  • Notifikasi facade
  • Configuration publishing
  • Blade directives

๐ŸŽจ Blade Integration

Method 1: Helper Function

{!! app('notifikasi')->render() !!}

Method 2: Facade

{!! Notifikasi::render() !!}

Method 3: Component (if published)

<x-notifikasi />

Method 4: Directive

@notifikasi

๐ŸŽฎ Controller Usage

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Rzlco\Notifikasi\Contracts\NotifikasiInterface;
use Rzlco\Notifikasi\Facades\Notifikasi;

class PostController extends Controller
{
    // Method 1: Dependency Injection
    public function store(Request $request, NotifikasiInterface $notifikasi)
    {
        $post = Post::create($request->validated());
        
        $notifikasi->success('Post Created!', "Your post '{$post->title}' has been published.");
        
        return redirect()->route('posts.index');
    }
    
    // Method 2: Facade
    public function update(Request $request, Post $post)
    {
        $post->update($request->validated());
        
        Notifikasi::success('Post Updated!', 'Your changes have been saved successfully.');
        
        return back();
    }
    
    // Method 3: Helper
    public function destroy(Post $post)
    {
        $title = $post->title;
        $post->delete();
        
        notifikasi()->info('Post Deleted', "'{$title}' has been moved to trash.");
        
        return back();
    }
}

โš™๏ธ Configuration File

// config/notifikasi.php
<?php

return [
    'default' => env('NOTIFIKASI_STORAGE', 'session'),
    
    'storages' => [
        'session' => [
            'driver' => 'session',
            'key' => 'rzlco_notifications',
        ],
    ],
    
    'defaults' => [
        'position' => env('NOTIFIKASI_POSITION', 'top-right'),
        'duration' => (int) env('NOTIFIKASI_DURATION', 5000),
        'theme' => env('NOTIFIKASI_THEME', 'auto'),
        'sound' => (bool) env('NOTIFIKASI_SOUND', true),
        'show_time' => (bool) env('NOTIFIKASI_SHOW_TIME', true),
        'time_format' => env('NOTIFIKASI_TIME_FORMAT', '12'),
        // ... more options
    ],
];

๐ŸŒ Environment Variables

# .env
NOTIFIKASI_POSITION=top-right
NOTIFIKASI_DURATION=5000
NOTIFIKASI_THEME=auto
NOTIFIKASI_SOUND=true
NOTIFIKASI_SHOW_TIME=true
NOTIFIKASI_TIME_FORMAT=12

๐Ÿ› ๏ธ Advanced Configuration

๐ŸŽจ Theme Customization

// Custom theme configuration
$config = [
    'theme' => 'custom',
    'colors' => [
        'success' => ['light' => '#00C851', 'dark' => '#00FF41'],
        'error' => ['light' => '#FF4444', 'dark' => '#FF6B6B'],
        'warning' => ['light' => '#FF8800', 'dark' => '#FFB347'],
        'info' => ['light' => '#33B5E5', 'dark' => '#87CEEB'],
    ],
    'background_opacity' => 0.95,
    'background_blur' => 20,
    'border_radius' => 12,
];

$notifikasi = new Notifikasi(new SessionStorage(), $config);

๐Ÿ”Š Audio Configuration

$config = [
    'sound' => [
        'enabled' => true,
        'volume' => 0.3,
        'frequencies' => [
            'success' => [800, 1000],  // [frequency, harmonic]
            'error' => [400, 300],
            'warning' => [600, 800],
            'info' => [500, 700],
        ],
    ],
];

๐Ÿ“ฑ Responsive Settings

$config = [
    'mobile' => [
        'breakpoint' => 640,
        'full_width' => true,
        'margin' => 10,
        'stacking' => 'vertical',
    ],
];

โšก Performance Tuning

$config = [
    'performance' => [
        'debounce_delay' => 100,
        'animation_fps' => 60,
        'lazy_load' => true,
        'preload_assets' => false,
        'stagger_delay' => 100,
    ],
];

๐ŸŽญ Theming & Styling

๐ŸŒˆ Built-in Themes

Auto Theme (Default)

  • Automatically switches between light/dark based on system preference
  • Uses CSS prefers-color-scheme media query

Light Theme

  • Clean, bright appearance
  • High contrast for excellent readability

Dark Theme

  • Easy on the eyes in low-light conditions
  • OLED-friendly pure blacks

๐ŸŽจ Custom CSS Variables

:root {
    /* Spacing */
    --rzlco-notifikasi-blur: 25px;
    --rzlco-notifikasi-radius: 16px;
    --rzlco-notifikasi-padding: 16px 20px;
    
    /* Animation */
    --rzlco-notifikasi-duration: 300ms;
    --rzlco-notifikasi-easing: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Colors */
    --rzlco-notifikasi-success: #22c55e;
    --rzlco-notifikasi-error: #ef4444;
    --rzlco-notifikasi-warning: #f59e0b;
    --rzlco-notifikasi-info: #3b82f6;
}

๐ŸŽฏ CSS Class Override

/* Custom notification styles */
.rzlco-notifikasi-notification {
    backdrop-filter: blur(var(--rzlco-notifikasi-blur));
    border-radius: var(--rzlco-notifikasi-radius);
}

/* Custom success color */
.rzlco-notifikasi-success .rzlco-notifikasi-icon {
    background: var(--rzlco-notifikasi-success);
}

/* Position-specific styling */
.rzlco-notifikasi-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

๐Ÿ“ฑ Responsive Design

๐Ÿ“ Breakpoint System

/* Mobile devices */
@media (max-width: 640px) {
    .rzlco-notifikasi-container {
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
    }
    
    .rzlco-notifikasi-notification {
        min-width: auto !important;
        max-width: none !important;
        margin-bottom: 8px !important;
    }
}

๐Ÿ“ฑ Mobile Optimizations

  • Full-width notifications on small screens
  • Reduced margins for more screen real estate
  • Touch-friendly close buttons (minimum 44px hit area)
  • Optimized animations for lower-powered devices

๐Ÿ’ป Desktop Features

  • Hover effects with subtle scaling and shadow changes
  • Keyboard navigation support
  • Multiple positioning options
  • Sound effects with Web Audio API

โ™ฟ Accessibility

๐ŸŽฏ WCAG 2.1 AA Compliance

  • Color Contrast: All text meets 4.5:1 contrast ratio
  • Focus Management: Keyboard navigation support
  • Screen Readers: ARIA labels and live regions
  • Reduced Motion: Respects prefers-reduced-motion

๐Ÿ”Š Screen Reader Support

<div role="alert" aria-live="polite" aria-atomic="true">
    <div class="rzlco-notifikasi-title">Payment Successful</div>
    <div class="rzlco-notifikasi-message">Your order has been processed</div>
</div>

โŒจ๏ธ Keyboard Navigation

  • Tab: Navigate between notifications
  • Enter/Space: Activate close button
  • Escape: Close focused notification

๐ŸŽจ High Contrast Mode

@media (prefers-contrast: high) {
    .rzlco-notifikasi-notification {
        border: 2px solid currentColor;
        background: Canvas;
        color: CanvasText;
    }
}

๐Ÿš€ Performance

โšก Benchmarks

Metric Value Comparison
First Paint < 16ms 4x faster than competitors
Bundle Size 48KB 75% smaller than alternatives
Memory Usage < 2MB Constant, no memory leaks
Animation FPS 60fps Hardware accelerated

๐Ÿ”ง Optimization Techniques

1. Hardware Acceleration

.rzlco-notifikasi-notification {
    transform: translateZ(0); /* Force GPU layer */
    will-change: transform, opacity;
}

2. RequestAnimationFrame

showNotification(notification) {
    requestAnimationFrame(() => {
        notification.classList.add('rzlco-notifikasi-show');
    });
}

3. Efficient DOM Manipulation

  • Batch DOM updates
  • Use CSS transforms instead of position changes
  • Minimize reflows and repaints

4. Memory Management

hideNotification(notification) {
    // Clear timers
    if (this.notifications.has(notification.id)) {
        clearTimeout(this.notifications.get(notification.id));
        this.notifications.delete(notification.id);
    }
    
    // Remove from DOM
    setTimeout(() => {
        if (notification.parentNode) {
            notification.parentNode.removeChild(notification);
        }
    }, this.config.animationDuration);
}

๐Ÿงช Testing

โœ… Test Results Summary

Total Coverage: 100%

  • Tests Executed: 63
  • Assertions: 145
  • Passed: 62 โœ…
  • Skipped: 1 โญ๏ธ (Laravel session test)
  • Failed: 0 โŒ
  • Errors: 0 โš ๏ธ

๐ŸŽฏ Test Categories

Unit Tests (22 tests)

  • Notification class instantiation and properties
  • Type safety and enum handling
  • Serialization and deserialization
  • Options and configuration management
  • Unicode and special character support

Integration Tests (41 tests)

  • Core notification methods (success, error, warning, info)
  • Fluent interface functionality
  • Configuration inheritance and overrides
  • HTML rendering and CSS generation
  • JavaScript integration and event handling
  • Time display and formatting
  • Theme system and responsive design
  • Animation and interaction testing

๐Ÿงช Testing Command

# Run all tests
composer test

# Run with coverage
composer test:coverage

# Run specific test suite
./vendor/bin/phpunit --filter NotificationTest

# Run with detailed output
./vendor/bin/phpunit --testdox

๐Ÿ“Š Quality Metrics

# Static analysis
composer phpstan

# Code style
composer phpcs

# Fix code style
composer phpcbf

๐Ÿ—บ๏ธ Roadmap

๐ŸŽฏ Current Version: v0.3.0 (July 2025)

Core Foundation Complete

  • โœ… Apple-inspired liquid glass design
  • โœ… Full Laravel integration
  • โœ… Comprehensive testing suite
  • โœ… Performance optimizations
  • โœ… Accessibility compliance

๐Ÿ“… Q3 2025 - Version 1.0

Production Ready Release

  • ๐Ÿ”„ Database storage driver
  • ๐Ÿ”„ Queue integration for Laravel
  • ๐Ÿ”„ Advanced theming system
  • ๐Ÿ”„ TypeScript definitions
  • ๐Ÿ”„ React/Vue components
  • ๐Ÿ”„ Comprehensive documentation site
  • ๐Ÿ”„ Performance profiling tools

๐Ÿ“… Q4 2025 - Version 1.1

Enterprise Features

  • ๐Ÿ”ฎ Real-time notifications (WebSocket)
  • ๐Ÿ”ฎ Email notification fallback
  • ๐Ÿ”ฎ Push notification support
  • ๐Ÿ”ฎ Advanced analytics
  • ๐Ÿ”ฎ A/B testing framework
  • ๐Ÿ”ฎ Multi-language support
  • ๐Ÿ”ฎ Enterprise authentication

๐Ÿ“… Q1 2026 - Version 2.0

Next Generation

  • ๐Ÿ”ฎ AI-powered notification optimization
  • ๐Ÿ”ฎ Advanced personalization
  • ๐Ÿ”ฎ Cross-platform mobile apps
  • ๐Ÿ”ฎ Voice notifications
  • ๐Ÿ”ฎ Augmented reality indicators
  • ๐Ÿ”ฎ Machine learning insights
  • ๐Ÿ”ฎ Blockchain verification

Legend: โœ… Complete | ๐Ÿ”„ In Progress | ๐Ÿ”ฎ Planned

๐Ÿค Contributing

๐ŸŽฏ How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿงช Development Setup

# Clone the repository
git clone https://github.com/rzlco666/notifikasi.git
cd notifikasi

# Install dependencies
composer install

# Run tests
composer test

# Check code style
composer phpcs

๐Ÿ“‹ Contribution Guidelines

  • Code Style: Follow PSR-12 standards
  • Testing: All new features must include tests
  • Documentation: Update relevant documentation
  • Performance: Consider performance implications
  • Accessibility: Maintain WCAG compliance

๐Ÿ†˜ Support

๐Ÿ“š Documentation

๐Ÿ› Issues & Support

๐Ÿ’ผ Commercial Support

For enterprise support, custom development, or consulting:

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Made with โค๏ธ by Rzlco666

Bringing Apple's design philosophy to web development

โญ Star this repo โ€ข ๐Ÿ› Report Bug โ€ข ๐Ÿ’ก Request Feature