Download the PHP package wm/wm-package without Composer

On this page you can find all versions of the php package wm/wm-package. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wm-package

Webmapp Laravel wm-package

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

You can publish and run the migrations with:

You can publish the config file with :

Usage

You can use Services with:

ServiceClass::make()->method() eg: GeometryComputationService::make()->convertToPoint($model)

You can use Models with or without extending them: class MyEcTrackModel extends Wm\WmPackage\Models\EcTrack {...}

You can use Nova resources extending them: class MyEcTrackNovaResource extends Wm\WmPackage\Nova\EcTrack {...}

You can use all package APIs with related controllers, see them with php artisan route:list

You can use all clients with dependency injection or with other instanciation methods: app( Wm\WmPackage\Http\Clients\DemClient::class)->getTechData($geojson);

Update

You can update the package via composer:

or updating it as submodule

Developing

To use docker containers you need to run docker compose up -d and enter inside with docker compose exec -it php bash or directly docker compose exec -it php composer test (check permissions on files before run it, if you have problems use the -u param on exec command with the id of the user who owns project files and directories, to check your current user id you can use the command id).

Docker has the following containers:

You can use them with testbench to run a complete Laravel instance with this package (see testing section for more details). Eg, you can use tesbench to run artisan commands: ./vendor/bin/testbench migrate

We use conventional commits for commit's messages (https://www.conventionalcommits.org/en/v1.0.0/). Create a feature/fix branch from main then ask a PR to merge it into develop branch.

On a laravel instance

If you need this package on full laravel instance you have to add this repository as submodule in the root path of Laravel with git submodule add {git repo}, then add a new composer path repository in the laravel composer.json file:

at last you can install the package with compose require wm/wm-package

JWT

JWT will be installed automatically as a dependency. Users only need to configure the JWT environment variables in the .env file using the command php artisan jwt:secret.

The JWT package is managed as a dependency of wm-package and does not need to be installed separately in the main application.

Elasticsearch

https://laravel.com/docs/11.x/scout https://github.com/matchish/laravel-scout-elasticsearch

elasticsearch mapping and settings: config/wm-elasticsearch.php

elasticsearch controller: src/Http/Controllers/Api/ElasticsearchController.php

Geohub Import

This package provides an Artisan command to import data from Geohub. To ensure data integrity and correctly process all relationships, the import process must start from an app entity. The command will then import all related data in a cascading manner.

The import architecture is structured around a pattern of services, jobs, and a central configuration, with an Artisan command as the entry point.

Architecture Overview

The main components are:

  1. CLI Command (WmImportFromGeohubCommand): The entry point to initiate imports.
  2. Services (GeohubImportService, EcMediaImportService): Handle the core business logic, data transformation, and orchestration.
  3. Jobs (e.g., ImportAppJob, ImportEcTrackJob): Perform specific import operations for different entities in the background.
  4. Configuration (config/wm-geohub-import.php): Contains mappings, database connections for Geohub, and other settings that define how the import process behaves.

Command Usage

The main command is wm:import-from-geohub.

  1. Import a specific application and its related data: This is the standard way to import a complete set of data related to a specific application.

    Replace <geohub_app_id> with the ID of the application in Geohub.

  2. Import all applications and their related data: If no model or ID is specified (or if app is specified without an ID), the command will import all app entities from Geohub, subsequently triggering the import for all their related data.

    Or:

Import Process Deep Dive

The import process is orchestrated by GeohubImportService.

1. GeohubImportService - The Core Orchestrator

This service is central to the import system and manages:

2. Data Mapping and Configuration (config/wm-geohub-import.php)

This crucial configuration file defines how different entities are handled. For each entity type, it specifies:

Example: ec_media configuration snippet:

3. Job Hierarchy and Structure

Import jobs are organized hierarchically to share common logic:

Each job typically follows a structure with these key methods:

4. Data Transformation (DataTransformer)

The DataTransformer class is a utility responsible for converting data types and structures.

Example: Transforming a translatable name field: Mapping in wm-geohub-import.php:

If Geohub name is {"it":"Sentiero del Monte","en":"Mountain Trail"}, it's transformed to ['it' => 'Sentiero del Monte', 'en' => 'Mountain Trail'].

5. Special Case: Media Import (ImportEcMediaJob & EcMediaImportService)

Media import (images, files) involves ImportEcMediaJob and potentially EcMediaImportService for more complex scenarios:

  1. Data Retrieval: Fetches media metadata from Geohub.
  2. Relationship Identification: Determines which local entity the media is associated with.
  3. Download & Upload: Downloads the actual file from Geohub's storage and uploads it to the configured local storage (e.g., AWS S3 via Spatie Media Library).
  4. Metadata Storage: Saves relevant metadata, including custom properties.

6. Queues, Batching, and Error Handling

7. Performance Considerations

The system is designed to handle potentially large volumes of data:

Summary of Import Flow

When an import is initiated (typically for an app):

  1. WmImportFromGeohubCommand delegates to GeohubImportService.
  2. GeohubImportService connects to the Geohub DB and identifies entities to import (starting with the specified app or all apps).
  3. It creates and dispatches a batch of jobs (e.g., ImportAppJob).
  4. Each job in the sequence: a. Fetches data from Geohub (fetchData). b. Transforms data using mappings and DataTransformer (transformData). c. Creates or updates the entity in the local database (importData). d. Queues further jobs for dependent entities (processDependencies).
  5. Media imports handle file downloads/uploads separately.
  6. The process is logged, and errors are managed to ensure robustness.

This architecture provides a modular, robust, configurable, and scalable process for synchronizing data from Geohub.

Testing

These tools are used to test the stand alone instance of wm-package: https://packages.tools/

Execute these commands to runs tests:

./vendor/bin/testbench vendor:publish --tag="wm-package-migrations" ./vendor/bin/testbench migrate It migrates workbench tables on a postgres database.

composer test To run tests.

If an evaluation of testbench env I suggest to use the config() function (eg: config('database.connections')) with the testbench implementation of tinker ./vendor/bin/testbench tinker, it is also useful to understand which things are loaded on the testbench env.

Testbench reference: https://packages.tools/testbench.html Workbench reference: https://packages.tools/workbench.html

Also a simple php docker container is available to run tests, you can start it using docker compose up -d and enter inside with docker compose exec -it php bash or directly docker compose exec -it php composer test (check permissions on files before run it, if you have problems use the -u param on exec command with the id of the user who owns project files and directories, to check your current user id you can use the command id).

Pushing

We use convetional commits (https://www.conventionalcommits.org/en/v1.0.0/) to add commits to this repo. Please create a new branch then push it and ask a pull request via github interface from your feature/fix branch to develop.

Run ./vendor/bin/phpstan before push to evaluate phpstan suggestions

License

The MIT License (MIT). Please see License File for more information.

Docs

https://github.com/spatie/laravel-package-tools

https://laravel.com/docs/9.x/facades#facades-vs-dependency-injection

https://pestphp.com/

https://packages.tools


All versions of wm-package with dependencies

PHP Build Version
Package Version
Requires php Version >8.1
chillerlan/php-qrcode Version ^5.0
christiankuri/laravel-favorite Version ^1.4
cweagans/composer-patches Version ^1.7
ebess/advanced-nova-media-library Version ^5.0
ezyang/htmlpurifier Version ^4.19
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0 || ^13.0
intervention/image Version ^2.5
jenssegers/agent Version ^2.6
kiritokatklian/nova-permission Version *
kongulov/nova-tab-translatable Version ^2.1
laravel/framework Version ^10.0 || ^11.0 || ^12.0 || ^13.0
laravel/horizon Version ^5.30
laravel/nova Version ^5.0
laravel/sanctum Version *
laravel/scout Version ^10.11
league/flysystem-aws-s3-v3 Version ^3.0
league/flysystem-sftp-v3 Version ^3.0
maatwebsite/excel Version ^3.1
marshmallow/nova-tiptap Version ^5.1 || ^6.0
matchish/laravel-scout-elasticsearch Version ^7.10
ndamiens/gisconverter Version ^1.0
outl1ne/nova-multiselect-field Version ^5.0.1
predis/predis Version ^2.3
sentry/sentry-laravel Version ^4.13
spatie/laravel-backup Version ^9.2
spatie/laravel-medialibrary Version ^11.12
spatie/laravel-package-tools Version >1.16
spatie/laravel-permission Version *
spatie/laravel-translatable Version ^6.9
tymon/jwt-auth Version >2.0
whitecube/nova-flexible-content Version ^2.0.1
wm/map-multi-linestring Version ^1.0
wm/map-multi-polygon Version ^1.0
wm/map-point Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wm/wm-package contains the following files

Loading the files please wait ...