PHPackages                             websystem-sro/gls-map-widget - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. websystem-sro/gls-map-widget

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

websystem-sro/gls-map-widget
============================

This is my package gls-map-widget

v1.0.6(9mo ago)0131[2 PRs](https://github.com/WebSystem-studio/laravel-gls-map-widget/pulls)MITPHPPHP ^8.3|^8.4CI passing

Since Sep 28Pushed 2mo agoCompare

[ Source](https://github.com/WebSystem-studio/laravel-gls-map-widget)[ Packagist](https://packagist.org/packages/websystem-sro/gls-map-widget)[ Docs](https://github.com/WebSystem-studio/laravel-gls-map-widget)[ GitHub Sponsors](https://github.com/:vendor_name)[ RSS](/packages/websystem-sro-gls-map-widget/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (13)Versions (11)Used By (0)

Laravel GLS Map Widget
======================

[](#laravel-gls-map-widget)

[![PHP Version](https://camo.githubusercontent.com/aa5173f35ff61eb70850b202e6ba4aca7d743ee098898e6ccf6338f2aed642dd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c75652e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Laravel](https://camo.githubusercontent.com/a8b832d94a9b342d7dedab139e97130178e848c9555776985a5d2f721a86584f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125324225323025374325433225413031322532422d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![License](https://camo.githubusercontent.com/6c711032aff1ca0eb6b211aa6cb3649ce7fd64a7714e1181d4bb457f9680e7cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Tests](https://camo.githubusercontent.com/7670b93a85f352014529935c78d785c2dd257d1b435e668926e967278b5154dd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d34362532307061737365642d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](#testing)

A Laravel Blade component for integrating GLS ParcelShop and GLS Locker finder widget with OpenStreetMap. This package provides an easy-to-use component that supports all GLS widget features including geolocation, country/language detection, and various filtering options.

Features
--------

[](#features)

- 🗺️ **Full GLS Widget Integration** - Supports both embedded widget and dialog modes
- 🌍 **Multi-Country Support** - Works with all GLS supported countries (21 countries)
- 📍 **Automatic Geolocation** - Optional browser-based location detection with fallback
- 🎛️ **Flexible Filtering** - Filter by parcel shops, lockers, or drop-off points only
- 🎨 **Customizable** - Configurable dimensions, styling, and behavior
- 🧪 **Well Tested** - Comprehensive PEST test suite
- ⚡ **Easy to Use** - Simple Blade component integration

Supported Countries
-------------------

[](#supported-countries)

Austria, Belgium, Bulgaria, Czech Republic, Germany, Denmark, Spain, Finland, France, Greece, Croatia, Hungary, Italy, Luxembourg, Netherlands, Poland, Portugal, Romania, Serbia, Slovenia, Slovakia.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require websystem-sro/gls-map-widget
```

Publish the config file with:

```
php artisan vendor:publish --tag="gls-map-widget-config"
```

Publish the JavaScript assets:

```
php artisan vendor:publish --tag="gls-map-widget-assets"
```

Optionally, you can publish the views:

```
php artisan vendor:publish --tag="gls-map-widget-views"
```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
// Basic widget for Slovakia

// With custom dimensions

// With geolocation (auto-detects user's country)

```

### Advanced Usage

[](#advanced-usage)

```
// Parcel lockers only with English language

// Drop-off points only

// Dialog modal version

    Select Delivery Point

```

Component Attributes
--------------------

[](#component-attributes)

AttributeTypeDefaultDescription`country`string`SK`Two-letter country code (AT, BE, BG, CZ, DE, DK, ES, FI, FR, GR, HR, HU, IT, LU, NL, PL, PT, RO, RS, SI, SK)`language`stringautoTwo-letter language code (CS, HR, HU, RO, SR, SL, SK, PL, EN, DE, FR, ES, IT, BG)`width`string`100%`Widget width (CSS value)`height`string`600px`Widget height (CSS value)`filter-type`stringnullFilter by type: `parcel-shop` or `parcel-locker``dropoffpoints-only`boolean`false`Show only drop-off points`use-geolocation`boolean`false`Enable automatic location detection`id`stringautoCustom element ID`widget-type`string`widget`Widget type: `widget` or `dialog`Event Handling
--------------

[](#event-handling)

The component dispatches events when a delivery point is selected:

```
// Listen for delivery point selection
document.addEventListener('gls-delivery-point-selected', function(event) {
    console.log('Selected delivery point:', event.detail.deliveryPoint);

    // Access delivery point data
    const point = event.detail.deliveryPoint;
    console.log('ID:', point.id);
    console.log('Name:', point.name);
    console.log('Address:', point.contact.address);
    console.log('City:', point.contact.city);
    console.log('Postal Code:', point.contact.postalCode);
});

// Listen for geolocation updates
document.addEventListener('gls-location-updated', function(event) {
    console.log('Location updated to:', event.detail.countryCode);
    console.log('From cache:', event.detail.isFromCache);
    console.log('Postal code:', event.detail.postalCode);
});

// Clear geolocation cache (for testing/debugging)
window.clearGlsGeolocationCache();
```

Geolocation
-----------

[](#geolocation)

The package includes advanced geolocation functionality:

```

```

### How it works:

[](#how-it-works)

1. **Cache Check** - First checks localStorage for cached geolocation data (24h validity)
2. **Browser Geolocation** - If no cache, requests user's GPS coordinates
3. **Reverse Geocoding** - Determines country and postal code using OpenStreetMap Nominatim
4. **Auto-Search** - Automatically triggers search in GLS widget with detected postal code
5. **Smart Caching** - Saves location data to localStorage for instant future loads
6. **Fallback** - Gracefully falls back to default country if geolocation fails

### Privacy &amp; Permissions

[](#privacy--permissions)

- Geolocation only works with user consent
- No coordinate data is sent to your server
- Uses OpenStreetMap's free Nominatim service
- Respects browser privacy settings

Configuration
-------------

[](#configuration)

The config file provides extensive customization options:

```
return [
    // Country-specific script endpoints
    'country_endpoints' => [
        'SK' => 'https://map.gls-slovakia.com/widget/gls-dpm.js',
        'CZ' => 'https://map.gls-czech.com/widget/gls-dpm.js',
        // ... all supported countries
    ],

    // Default language for each country
    'country_language_mapping' => [
        'SK' => 'SK',
        'CZ' => 'CS',
        // ... mappings for all countries
    ],

    // Default widget settings
    'defaults' => [
        'width' => '100%',
        'height' => '600px',
        'country' => 'SK',
        'use_geolocation' => false,
    ],

    // Geolocation configuration
    'geolocation' => [
        'reverse_geocoding_service' => 'nominatim',
        'nominatim_endpoint' => 'https://nominatim.openstreetmap.org/reverse',
        'timeout_ms' => 10000,
        'cache_duration' => 3600,
    ],
];
```

Examples
--------

[](#examples)

### E-commerce Checkout Integration

[](#e-commerce-checkout-integration)

```

    Select Delivery Point

document.addEventListener('gls-delivery-point-selected', function(event) {
    const deliveryPoint = event.detail.deliveryPoint;

    // Update hidden form field
    document.getElementById('delivery-point-input').value = JSON.stringify(deliveryPoint);

    // Update UI
    document.getElementById('selected-point-info').innerHTML = `
        ${deliveryPoint.name}
        ${deliveryPoint.contact.address}
        ${deliveryPoint.contact.postalCode} ${deliveryPoint.contact.city}
    `;
});

```

### Modal Integration

[](#modal-integration)

```

    📦 Choose Pickup Point

```

### Multi-Language Support

[](#multi-language-support)

```
@switch(app()->getLocale())
    @case('cs')

        @break
    @case('sk')

        @break
    @default

@endswitch
```

Browser Compatibility
---------------------

[](#browser-compatibility)

- **Modern Browsers**: Chrome 70+, Firefox 70+, Safari 12+, Edge 79+
- **Geolocation**: Requires HTTPS in production
- **JavaScript**: ES6 modules supported

Performance
-----------

[](#performance)

- **Lazy Loading**: GLS scripts load only when needed
- **Caching**: Geolocation results cached for 1 hour
- **Lightweight**: ~15KB additional JavaScript
- **CDN**: Uses GLS official CDN endpoints

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

**Geolocation not working:**

- Ensure your site uses HTTPS in production
- Check browser permissions
- Verify Nominatim endpoint is accessible

**Widget not loading:**

- Check console for JavaScript errors
- Verify country code is supported
- Ensure GLS scripts are accessible

**Styling issues:**

- Publish and customize views if needed
- Check for CSS conflicts
- Use browser developer tools to debug

### Debug Mode

[](#debug-mode)

```

// Enable debugging
console.log('GLS Config:', window.glsMapConfig);

// Listen to all events
document.addEventListener('gls-location-updated', console.log);
document.addEventListener('gls-delivery-point-selected', console.log);

```

API Reference
-------------

[](#api-reference)

### GlsMapComponent Methods

[](#glsmapcomponent-methods)

```
// Get widget HTML attributes
$component->getWidgetAttributes(): array

// Get widget attributes as HTML string
$component->getWidgetAttributesString(): string

// Get container CSS styles
$component->getContainerStyles(): string

// Get geolocation configuration
$component->getGeolocationConfig(): array
```

### JavaScript API

[](#javascript-api)

```
// Initialize geolocation manually
window.initializeGlsGeolocation(elementId);

// Access geolocation instance
const geolocation = new window.GlsGeolocation(config);

// Open modal programmatically
window.glsOpenModal(elementId);
```

Testing
-------

[](#testing)

### Running All Tests

[](#running-all-tests)

```
composer test
```

### Unit Tests Only

[](#unit-tests-only)

```
# Run unit tests without browser tests
npm run test-unit
# or
./vendor/bin/pest --exclude-group=browser
```

### Browser Tests (Local Only)

[](#browser-tests-local-only)

Browser tests require Playwright and are configured to run **only locally** (skipped in CI):

```
# Install Playwright browsers (first time only)
npm run install-playwright

# Run browser tests
npm run test-browser
# or
./vendor/bin/pest --group=browser
```

**Note**: Browser tests are configured for local development only:

- Use `->skipOnCi()` modifier to skip in CI environments
- GitHub Actions workflow explicitly excludes browser tests (`--exclude-group=browser`)
- Playwright installation not required in CI/production environments

### Test Types

[](#test-types)

The package includes comprehensive test coverage:

- **Unit Tests** (39 tests): Component logic, validation, and configuration
- **Feature Tests**: Blade rendering and service provider integration
- **Browser Tests** (7 tests): Real browser testing with Playwright
    - Widget rendering in different browsers
    - Responsive design testing
    - Dialog functionality
    - Filter types validation
    - Multi-country widget support
    - Smoke testing
    - Visual regression testing

### CI/CD Testing

[](#cicd-testing)

The package is configured for seamless CI/CD workflows:

- **GitHub Actions**: Automatically runs unit tests only (`--exclude-group=browser`)
- **Multi-Platform**: Tests on Ubuntu and Windows
- **Multi-Version**: PHP 8.3/8.4 + Laravel 11/12 combinations
- **PHPStan**: Static analysis with level 5 compliance
- **No Playwright Required**: Browser tests excluded from CI environments

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

---

**Made with ❤️ by [WebSystem Studio](https://github.com/WebSystem-studio)**

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance73

Regular maintenance activity

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 89.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

7

Last Release

278d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/58297666?v=4)[Martin Halaj](/maintainers/Martin-1182)[@Martin-1182](https://github.com/Martin-1182)

---

Top Contributors

[![Martin-1182](https://avatars.githubusercontent.com/u/58297666?v=4)](https://github.com/Martin-1182 "Martin-1182 (33 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelwebsystemgls-map-widget

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/websystem-sro-gls-map-widget/health.svg)

```
[![Health](https://phpackages.com/badges/websystem-sro-gls-map-widget/health.svg)](https://phpackages.com/packages/websystem-sro-gls-map-widget)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)[tapp/filament-form-builder

User facing form builder using Filament components

132.4k3](/packages/tapp-filament-form-builder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
