PHP code example of s2br / nativephp-mobile-splashscreen
1. Go to this page and download the library: Download s2br/nativephp-mobile-splashscreen 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/ */
s2br / nativephp-mobile-splashscreen example snippets
> use S2BR\MobileSplashscreen\MobileSplashscreenServiceProvider;
>
> public function plugins(): array
> {
> return [
> MobileSplashscreenServiceProvider::class,
> ];
> }
>
use S2BR\MobileSplashscreen\Facades\MobileSplashscreen;
MobileSplashscreen::syncFromUrl('https://your-cdn.com/animations.json')
->resolveActive(daysAhead: 30);
MobileSplashscreen::hasActive(); // true if schedule-local.json exists
MobileSplashscreen::clearActive(); // remove schedule-local.json (reverts to default)
use Livewire\Attributes\On;
use S2BR\MobileSplashscreen\Events\SplashscreenCompleted;
use S2BR\MobileSplashscreen\Events\SplashscreenLoopCompleted;
#[On('native:'.SplashscreenCompleted::class)]
public function onSplashDone(string $animationName, float $duration): void
{
// Dispatched after the splash exits (including any transition_out animation)
}
#[On('native:'.SplashscreenLoopCompleted::class)]
public function onSplashLoop(int $iteration, string $animationName): void
{
if ($iteration >= 3) {
// After 3 loops, do something in your app
}
}