### Install laravel-pwa-favicon via Composer Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/README.md Install the package via Composer. ```bash composer require jeffersongoncalves/laravel-pwa-favicon ``` -------------------------------- ### Link to manifest.json Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/README.md Reference the manifest in your
if not using the pwa-favicon::head view. ```html ``` -------------------------------- ### Run project test and analysis commands Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/resources/boost/skills/pwa-favicon-development/SKILL.md Common CLI commands for executing tests, checking coverage, performing static analysis, and formatting code. ```bash # Run all tests vendor/bin/pest # Run with coverage vendor/bin/pest --coverage # Static analysis vendor/bin/phpstan analyse # Code formatting vendor/bin/pint ``` -------------------------------- ### Test PWA manifest routes Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/resources/boost/skills/pwa-favicon-development/SKILL.md Demonstrates enabling routes per test and asserting manifest content, as well as verifying 404 behavior when disabled. ```php use JeffersonGoncalves\PwaFavicon\PwaFavicon; it('serves the manifest with a 512 any and maskable icon', function () { config()->set('pwa-favicon.enabled', true); PwaFavicon::routes(); $response = $this->get('/manifest.json'); $response->assertOk(); expect($response->headers->get('Content-Type'))->toContain('application/manifest+json'); $icons = $response->json('icons'); expect($icons)->toContain([ 'src' => 'https://cdn.test/resources/favicon/icon-512x512.png', 'sizes' => '512x512', 'type' => 'image/png', 'purpose' => 'any', ])->toContain([ 'src' => 'https://cdn.test/resources/favicon/icon-512x512-maskable.png', 'sizes' => '512x512', 'type' => 'image/png', 'purpose' => 'maskable', ]); }); it('404s the manifest route when disabled', function () { config()->set('pwa-favicon.enabled', false); $this->get('/manifest.json')->assertNotFound(); }); ``` -------------------------------- ### Required manifest icon files Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/README.md Required icon files under resources/favicon/ for the manifest icons. ```text resources/favicon/ android-icon-36x36.png (and each size in the `manifest.icons` map) android-icon-48x48.png android-icon-72x72.png android-icon-96x96.png android-icon-144x144.png android-icon-192x192.png icon-512x512.png icon-512x512-maskable.png ``` -------------------------------- ### Register routes in Service Provider Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/resources/boost/skills/pwa-favicon-development/SKILL.md The packageBooted method registers routes only if the pwa-favicon.enabled configuration flag is set to true. ```php public function packageBooted(): void { if (config('pwa-favicon.enabled', false)) { PwaFavicon::routes(); } } ``` -------------------------------- ### Publish pwa-favicon config Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/README.md Publish the package's config file. ```bash php artisan vendor:publish --tag="pwa-favicon-config" ``` -------------------------------- ### Include pwa-favicon::head with custom parameters Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/README.md Include the head view with custom parameters: themeColor, manifestUrl, themeColorId, and title. ```blade @include('pwa-favicon::head', [ 'themeColor' => '#0B0A09', 'manifestUrl' => '/manifest.json', 'themeColorId' => 'theme-color-meta', 'title' => 'My App', ]) ``` -------------------------------- ### Mock Vite asset resolver in tests Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/resources/boost/skills/pwa-favicon-development/SKILL.md Swaps the Vite resolver for a fake to handle icon paths that flow through Vite::asset() during testing. ```php use Illuminate\Foundation\Vite as FoundationVite; use Illuminate\Support\Facades\Vite; beforeEach(function () { $vite = Mockery::mock(FoundationVite::class); $vite->shouldReceive('asset')->andReturnUsing(fn (string $p) => 'https://cdn.test/'.$p); $vite->shouldReceive('content')->andReturnUsing(fn (string $p) => 'fake'); Vite::swap($vite); }); ``` -------------------------------- ### Published pwa-favicon config file Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/README.md Published config file for the package. Controls the manifest settings and the apple status bar style. ```php return [ 'enabled' => true, 'manifest' => [ 'name' => env('APP_NAME', 'Laravel'), 'short_name' => env('APP_NAME', 'Laravel'), 'description' => 'A Progressive Web App built with Laravel.', 'start_url' => '/?source=pwa', 'scope' => '/', 'display' => 'standalone', 'orientation' => 'any', 'theme_color' => '#ffffff', 'background_color' => '#ffffff', 'lang' => 'en', 'dir' => 'ltr', 'categories' => ['productivity'], 'icons' => [ '36' => '0.75', '48' => '1.0', '72' => '1.5', '96' => '2.0', '144' => '3.0', '192' => '4.0', ], ], 'apple_status_bar_style' => 'black-translucent', ]; ``` -------------------------------- ### Include pwa-favicon::head in layout Source: https://github.com/jeffersongoncalves/laravel-pwa-favicon/blob/master/README.md Include the PWA head view in your layout's to render all PWA head tags. ```blade {{-- ... --}} @include('pwa-favicon::head') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.