PHPackages                             webmapp/wm-osmfeatures - 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. webmapp/wm-osmfeatures

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

webmapp/wm-osmfeatures
======================

This is my package wm-osmfeatures

1.5.0(1y ago)0249MITPHPPHP ^8.2CI failing

Since May 3Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/webmappsrl/wm-osmfeatures)[ Packagist](https://packagist.org/packages/webmapp/wm-osmfeatures)[ Docs](https://github.com/webmapp/wm-osmfeatures)[ GitHub Sponsors](https://github.com/wm)[ RSS](/packages/webmapp-wm-osmfeatures/feed)WikiDiscussions main Synced 1mo ago

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

Package Documentation: WmOsmfeatures
------------------------------------

[](#package-documentation-wmosmfeatures)

### Introduction

[](#introduction)

The WmOsmfeatures package facilitates synchronization with OpenStreetMap (OSM) features, allowing for seamless integration of OSM data into your Laravel application. This documentation provides an overview of the package's functionality, usage, and integration.

### Features

[](#features)

- Fetch OSM features data via API
- Synchronize OSM features with local database
- Automatic handling of data updates

### Installation

[](#installation)

To install the WmOsmfeatures package, follow these steps:

1. Install the package via Composer:

    ```
    composer require webmapp/wm-osmfeatures

    ```
2. Configure your models to use the provided traits and interfaces.

### Usage

[](#usage)

#### Setting Up Models

[](#setting-up-models)

To enable synchronization with OSM features, follow these steps:

1. Implement the `OsmfeaturesSyncableInterface` interface in your model.
2. Use the `OsmfeaturesSyncableTrait` trait in your model.

Example:

```
use Wm\WmOsmfeatures\Interfaces\OsmfeaturesSyncableInterface;
use Wm\WmOsmfeatures\Traits\OsmfeaturesSyncableTrait;

class Municipality extends Model implements OsmfeaturesSyncableInterface
{
    use OsmfeaturesSyncableTrait;

    // Your model implementation
}
```

#### Configuration

[](#configuration)

In your model, implement the following methods from the `OsmfeaturesSyncableInterface` interface:

- `getOsmfeaturesEndpoint`: Returns the OSMFeatures API endpoint.
- `getOsmfeaturesListQueryParameters`: Returns the query parameters for listing features. Available universal parameters are: updated\_at, bbox, score. More informations can be found in the [osmfeatures api documentation](https://osmfeatures.maphub.it/api/documentation)
- `osmfeaturesUpdateLocalAfterSync`: Updates the local database after a successful OSMFeatures sync.

Example:

```
class Municipality extends Model implements OsmfeaturesSyncableInterface
{
    // ...

    public static function getOsmfeaturesEndpoint(): string
    {
        return 'https://osmfeatures.maphub.it/api/v1/features/admin-areas/';
    }

    public static function getOsmfeaturesListQueryParameters(): array
    {
        return ['admin_level' => 8];
    }

    public static function osmfeaturesUpdateLocalAfterSync(string $osmfeaturesId): void
    {
        // Your implementation
    }

    // ...
}
```

Also make sure to add osmfeatures columns to fillable attributes in your model.

```
protected $fillable = ['osmfeatures_id', 'osmfeatures_data', 'osmfeatures_updated_at'];

```

#### Synchronization

[](#synchronization)

To synchronize OSM features with your local database, you have two options:

1. **Automatic Synchronization**: Use the provided Artisan command `wm-osmfeatures:sync` to automatically synchronize all initialized models. This command prepares the models and starts the sync process for each one, pushing sync jobs to the queue.

    ```
    php artisan wm-osmfeatures:sync

    ```

    Alternatively you can provide a `--model=` option to perform the sync only for the specified model

    ```
    php artisan wm-osmfeatures:sync --model=Municipality

    ```
2. **Manual Import**: Manually import records from OSM features to the local database using the `wm-osmfeatures:import-first` command. This command takes a model and a file path as arguments and dispatches sync jobs for the specified model based on the osmfeatures IDs provided in the file.

    ```
    php artisan wm-osmfeatures:import-first {model} {filepath}

    ```

    The file must be in `.txt` format and should contain a list of osmfeatures IDs, each formatted as follows: `XYYYYY`, where `X` can be `N`, `W`, or `R`, and `Y` is a number greater than 0.

    Example:

    ```
    php artisan wm-osmfeatures:import-first Municipality storage/app/public/osmfeatures.txt

    ```

    Additionally, you can use the `wm-osmfeatures:import-sync` command to manually trigger the sync process for all initialized models. This command iterates over each model and starts the import process fetching data from osmfeatures API using osmfeatures\_id of each model.

    ```
    php artisan wm-osmfeatures:import-sync

    ```

    **Note:** The manual import commands are only available for models that implement the `OsmfeaturesImportableTrait`. Make sure to include the `OsmfeaturesImportableTrait` trait in your model as follows:

    ```
    use Wm\WmOsmfeatures\Traits\OsmfeaturesImportableTrait;
    use Wm/WmOsmfeatures\Interfaces\OsmfeaturesSyncableInterface;

    class Municipality extends Model implements OsmfeaturesSyncableInterface
    {
        use OsmfeaturesImportableTrait;

        //...
    }
    ```

#### How the OsmfeaturesSyncJob works

[](#how-the-osmfeaturessyncjob-works)

The `OsmfeaturesSyncJob` class is responsible for synchronizing OSM features with your local database. It makes a call to the OSM features API and uses the `osmfeaturesUpdateLocalAfterSync(string $osmfeaturesId)` method defined in your model interface to update the local database with the new data. The `OsmfeaturesSyncJob` class runs in the background and synchronizes OSM features with your local database using the methods defined in the `OsmfeaturesSyncableInterface`.

### Conclusion

[](#conclusion)

The WmOsmfeatures package simplifies the integration of OSM features into your Laravel application, providing seamless synchronization and data management capabilities. By following the provided guidelines, you can efficiently incorporate OSM data into your project and leverage its benefits.

For more information and detailed usage instructions, refer to the package documentation and source code.

### Support and Feedback

[](#support-and-feedback)

For support and feedback regarding the WmOsmfeatures package, please contact the package maintainers or open an issue on the GitHub repository. We appreciate any feedback and contributions to improve the package and its functionality.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance64

Regular maintenance activity

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.8% 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 ~25 days

Recently: every ~38 days

Total

7

Last Release

591d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cdf543f774c91267c506551e964a14e4011775f16ec7d08ff7ffa29f9ad6cfe7?d=identicon)[webmappsrl](/maintainers/webmappsrl)

![](https://www.gravatar.com/avatar/e2fb58c032d69cd1a58a3a8deee7156a7df4af20941e378d1b073e9203285a26?d=identicon)[gemanzo](/maintainers/gemanzo)

---

Top Contributors

[![gemanzo](https://avatars.githubusercontent.com/u/75580783?v=4)](https://github.com/gemanzo "gemanzo (87 commits)")[![peppedeka](https://avatars.githubusercontent.com/u/14872288?v=4)](https://github.com/peppedeka "peppedeka (19 commits)")[![webmappsrl](https://avatars.githubusercontent.com/u/35734764?v=4)](https://github.com/webmappsrl "webmappsrl (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

laravelwm-osmfeatureswebmappsrl

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/webmapp-wm-osmfeatures/health.svg)

```
[![Health](https://phpackages.com/badges/webmapp-wm-osmfeatures/health.svg)](https://phpackages.com/packages/webmapp-wm-osmfeatures)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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