| Package Data | |
|---|---|
| Maintainer Username: | eramitgupta |
| Maintainer Contact: | info.eramitgupta@gmail.com (Er Amiit Gupta) |
| Package Create Date: | 2024-09-14 |
| Package Last Update: | 2025-11-29 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2026-01-02 15:00:03 |
| Package Statistics | |
|---|---|
| Total Downloads: | 49,421 |
| Monthly Downloads: | 7,938 |
| Daily Downloads: | 222 |
| Total Stars: | 132 |
| Total Watchers: | 2 |
| Total Forks: | 17 |
| Total Open Issues: | 1 |
Laravel PWA is a package designed to seamlessly integrate Progressive Web Application (PWA) functionality into your Laravel projects. With this package, you can easily configure, update the manifest, and register service workers, enabling any Laravel app to function as a PWA.
config/pwa.php β control icons, theme color, name, and moreNote: PWAs require a secure HTTPS connection to work correctly. Ensure your application is hosted with HTTPS; otherwise, service workers and other PWA features will not function as expected.
To get started, install the package using Composer:
composer require erag/laravel-pwa
Ensure the service provider is registered in your /bootstrap/providers.php file:
use EragLaravelPwa\EragLaravelPwaServiceProvider;
return [
// ...
EragLaravelPwaServiceProvider::class,
];
Ensure the service provider is registered in your config/app.php file:
'providers' => [
// ...
EragLaravelPwa\EragLaravelPwaServiceProvider::class,
],
Once installed, publish the PWA configuration files using:
php artisan erag:install-pwa
This will create the required configuration file config/pwa.php and set up PWA functionality for your application.
config/pwa.phpThis is your main configuration file where you can customize the PWA settings.
return [
'install-button' => true, // Show or hide the install button globally.
'manifest' => [
'name' => 'Laravel PWA',
'short_name' => 'LPT',
'background_color' => '#6777ef',
'display' => 'fullscreen',
'description' => 'A Progressive Web Application setup for Laravel projects.',
'theme_color' => '#6777ef',
'icons' => [
[
'src' => 'logo.png',
'sizes' => '512x512',
'type' => 'image/png',
],
],
],
'debug' => env('APP_DEBUG', false), // Show or hide console.log in the browser globally.
'livewire-app' => false,
];
After changing config/pwa.php in your manifest array, run this command
You can update your PWA manifest file by running:
php artisan erag:update-manifest
To integrate PWA functionality into your layouts, use the provided Blade directives.
Place the @PwaHead directive inside the <head> tag of your main layout file:
<!DOCTYPE html>
<html lang="en">
<head>
@PwaHead <!-- Add this directive to include the PWA meta tags -->
<title>Your App Title</title>
</head>
<body>
Just before the closing </body> tag in your main layout file, add:
@RegisterServiceWorkerScript <!-- This registers the service worker -->
</body>
</html>
These directives will automatically generate the necessary tags and JavaScript for the PWA.
You can easily update the manifest dynamically at runtime using the provided PWA Facade.
use EragLaravelPwa\Facades\PWA;
PWA::update([
'name' => 'Laravel Apps',
'short_name' => 'LA',
'background_color' => '#6777ef',
'display' => 'fullscreen',
'description' => 'A Progressive Web Application setup for Laravel projects.',
'theme_color' => '#6777ef',
'icons' => [
[
'src' => 'logo.png',
'sizes' => '512x512',
'type' => 'image/png',
],
],
]);
manifest.json file in the public directory.β
Make sure public/ folder is writable to allow manifest updates!
This command updates the manifest.json file located in the public directory of your Laravel project.
To update the PWA logo dynamically, follow these steps: Your Laravel PWA is now configured to update the logo dynamically! π
Input Key Name: logo
Make sure the image is in PNG format, at least 512x512 pixels, and does not exceed 1024 KB in size.
<input type="file" name="logo" accept=".png">
array:2 [βΌ // EragLaravelPwa/src/Core/PWA.php:19
"_token" => "iKbZh21VsYZMpNd9TN12Ul5SoysQzkMXlQkhB5Ub"
"logo" => Illuminate\Http\UploadedFile{#1426 βΆ}]
namespace App\Http\Controllers;
use EragLaravelPwa\Core\PWA;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class SettingsController extends Controller
{
public function uploadLogo(Request $request)
{
$response = PWA::processLogo($request);
if ($response['status']) {
return redirect()->back()->with('success', $response['message']);
}
return redirect()->back()->withErrors($response['errors'] ?? ['Something went wrong.']);
}
}
Once uploaded, the new logo will be available at http://yourdomain.com/logo.png.
We appreciate your interest in contributing to this Laravel PWA project! Whether you're reporting issues, fixing bugs, or adding new features, your help is greatly appreciated.
Go to the repository page on GitHub.
Click the Fork button at the top-right corner of the repository page.
Clone your forked repository:
git clone https://github.com/your-username/laravel-pwa.git
If you encounter any issues, please check if the issue already exists in the Issues section. If not, create a new issue with the following details:
When you're ready to contribute, open a pull request describing the changes youβve made and how they improve the project. Please ensure:
Hereβs a simple example of how to use this package:
@PwaHead directive in your layout fileβs <head>.@RegisterServiceWorkerScript directive before the closing </body> tag.config/pwa.php to fit your projectβs needs.php artisan erag:pwa-update-manifest to update the manifest file.