Download the PHP package salesrender/plugin-core-geocoder without Composer

On this page you can find all versions of the php package salesrender/plugin-core-geocoder. 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 plugin-core-geocoder

Plugin Core Geocoder

Type-specific core framework for SalesRender GEOCODER plugins

Overview

salesrender/plugin-core-geocoder is a specialized core library that extends the base salesrender/plugin-core to build Geocoder-type plugins. Geocoder plugins resolve addresses to geographic coordinates, timezones, and structured address data.

This core provides:

Installation

Requirements

Architecture

How This Core Extends plugin-core

plugin-core-geocoder overrides both factory classes from the base plugin-core:

WebAppFactory (extends \SalesRender\Plugin\Core\Factories\WebAppFactory):

ConsoleAppFactory (extends \SalesRender\Plugin\Core\Factories\ConsoleAppFactory):

Request Flow

Getting Started: Creating a Geocoder Plugin

Step 1: Project Setup

Create a new project and add the dependency:

Create the directory structure:

Step 2: Bootstrap Configuration

Create bootstrap.php in the project root. This file configures all plugin components:

Key geocoder-specific configuration points:

Step 3: Implement GeocoderInterface

This is the core of your geocoder plugin. Create a class that implements GeocoderInterface:

The handle() method receives two parameters:

It must return an array of GeocoderResult objects. Each result contains a resolved Address, an optional Timezone, and an optional info string.

Step 4: Create Web Entry Point

Create public/index.php:

Create public/.htaccess:

Step 5: Create Console Entry Point

Create console.php:

Step 6: Create Settings Form

Create src/SettingsForm.php:

Step 7: Create .env

Create example.env (copy to .env for local development):

Step 8: Initialize & Deploy

HTTP Routes

Routes added by \SalesRender\Plugin\Core\Geocoder\Factories\WebAppFactory:

Method Path Description Source
POST /protected/geocoder/handle Receives geocoding requests. Parses the request body into typing (string) and address (Address), invokes GeocoderInterface::handle(), and returns a JSON array of GeocoderResult objects. Protected by middleware. GeocoderAction

Additionally, all base plugin-core routes are inherited:

Method Path Description
GET /info Plugin information
PUT /registration Plugin registration
GET /protected/forms/settings Settings form definition
PUT /protected/data/settings Save settings
GET /protected/data/settings Get settings data
GET /protected/autocomplete/{name} Autocomplete handler
GET /robots.txt Robots.txt

Request Format

POST /protected/geocoder/handle expects the following JSON body:

Response Format

Returns a JSON array of geocoder results:

Error Responses

Code Description
400 Invalid address data in the request
417 GeocoderHandleException -- geocoder-specific error during processing
501 Geocoder not configured (GeocoderContainer has no handler)

CLI Commands

The geocoder core does not add any new CLI commands beyond those inherited from the base plugin-core:

Command Description
db:create Create database tables
db:clean Clean database tables
specialRequest:queue Process special request queue
specialRequest:handle Handle a special request
cron Run all scheduled cron tasks
lang:add Add a translation language
lang:update Update translations
directory:clean Clean temporary directories

Key Classes & Interfaces

GeocoderInterface

Namespace: SalesRender\Plugin\Core\Geocoder\Components\Geocoder\GeocoderInterface

The primary interface that every geocoder plugin must implement:

GeocoderResult

Namespace: SalesRender\Plugin\Core\Geocoder\Components\Geocoder\GeocoderResult

A value object that represents a single geocoding result. Implements JsonSerializable.

Method Return Type Description
__construct(Address $address, ?Timezone $timezone, ?string $info = null) Create a result with address, optional timezone, and optional info
getAddress() Address The resolved/enhanced address
getTimezone() ?Timezone The resolved timezone (if available)
getInfo() ?string Additional informational text about this result

GeocoderContainer

Namespace: SalesRender\Plugin\Core\Geocoder\Components\Geocoder\GeocoderContainer

Static container for registering and retrieving the GeocoderInterface implementation.

Method Return Type Description
config(GeocoderInterface $geocoder) void Register the geocoder implementation
getHandler() GeocoderInterface Retrieve the registered geocoder. Throws GeocoderContainerException if not configured.

Timezone

Namespace: SalesRender\Plugin\Core\Geocoder\Components\Geocoder\Timezone

Represents a timezone, accepting either a named timezone or a UTC offset. Implements JsonSerializable.

Method Return Type Description
__construct(string $timezoneOrOffset) Create from a timezone name (e.g., "Europe/Moscow") or UTC offset (e.g., "UTC+03:00"). Throws InvalidTimezoneException if invalid.
getName() ?string The timezone name (e.g., "Europe/Moscow") or null if constructed from offset
getOffset() ?string The UTC offset (e.g., "UTC+03:00") or null if constructed from name

Examples:

The offset format must match the pattern UTC[+-]\d{2}:\d{2} (e.g., UTC+03:00, UTC-05:00). Named timezones must be valid PHP DateTimeZone identifiers.

GeocoderAction

Namespace: SalesRender\Plugin\Core\Geocoder\GeocoderAction

HTTP action that handles POST /protected/geocoder/handle. Implements ActionInterface. Parses the request body using dot notation (via Adbar\Dot), constructs an Address object with optional Location, and invokes the geocoder.

The action:

  1. Retrieves the geocoder from GeocoderContainer::getHandler()
  2. Extracts typing from the request body
  3. Constructs an Address from the address.* fields, including optional Location (latitude/longitude)
  4. Calls GeocoderInterface::handle($typing, $address)
  5. Returns the result array as JSON

Exceptions

Exception Namespace Description
GeocoderContainerException SalesRender\Plugin\Core\Geocoder\Exceptions Thrown when GeocoderContainer::getHandler() is called before configuration
GeocoderHandleException SalesRender\Plugin\Core\Geocoder\Exceptions Should be thrown by the geocoder implementation when an expected error occurs during geocoding. Results in a 417 HTTP response.
InvalidTimezoneException SalesRender\Plugin\Core\Geocoder\Exceptions Thrown when constructing a Timezone with an invalid name or offset

Example Plugin

See the reference implementation: plugin-example-geocoder

Dependencies

Package Version Purpose
salesrender/plugin-core ^0.4.0 Base plugin framework
salesrender/component-address ^1.0.0 Address and Location value objects
adbario/php-dot-notation ^2.2 Dot notation access for nested request data

See Also


All versions of plugin-core-geocoder with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
ext-json Version *
salesrender/plugin-core Version ^0.4.0
salesrender/component-address Version ^1.0.0
adbario/php-dot-notation Version ^2.2
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 salesrender/plugin-core-geocoder contains the following files

Loading the files please wait ...