PHP code example of noehassiel / confetti

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

    

noehassiel / confetti example snippets


public int $celebrateToken = 0;

public function markComplete(): void
{
    $this->task->complete();
    $this->celebrateToken++;   // ANY change fires a fresh burst
}

public function confettiFinished(): void
{
    // every particle from the last burst has died
}

use Noehassiel\Confetti\Facades\Confetti;

public function markComplete(): void
{
    $this->task->complete();

    Confetti::burst();   // hits the element with ref="default" — the default when unset
}

Confetti::burst('task-list');

public function switchAndBurst(): void
{
    $this->preset = 'corners'; // not on the device yet
    Confetti::burst();          // fires whatever preset WAS already showing
}

use Noehassiel\Confetti\Events\ConfettiBurstFailed;
use Native\Mobile\Attributes\On;

#[On(ConfettiBurstFailed::class)]
public function confettiMissing(string $ref, string $reason): void
{
    // the screen holding the element probably isn't the one on screen
}
js
import { burst, Events } from 'noehassiel-confetti';

// Same ref semantics as the PHP facade — omit it for the default element.
await burst();
await burst('task-list');