Download the PHP package gcgov/arcgisphpsdk without Composer

On this page you can find all versions of the php package gcgov/arcgisphpsdk. 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 arcgisphpsdk

arcgisphpsdk

An open source PHP SDK for interacting with Garrett County, Maryland's ArcGIS Enterprise implementation. It wraps the ArcGIS REST API with strongly typed PHP classes so server-side applications can authenticate, query, create, update, and delete features on hosted feature services, manage layer schemas (fields and coded-value domains), and geocode addresses.

The SDK is the server-side half of Garrett County's GIS integrations: PHP applications use it to keep their own databases in sync with hosted ArcGIS feature layers, while browser applications render those same layers with the ArcGIS Maps SDK for JavaScript (@arcgis/core). The county's bridges application (gcgov/bridge-api + gcgov/bridge-app) is the reference implementation and the source of the examples in this document.

Requirements

Installation

Production applications pin a tagged release (for example "gcgov/arcgisphpsdk": "^2.0"). During local development, consuming applications typically require dev-main and register the SDK as a symlinked path repository so edits take effect immediately:

Architecture at a glance

Classes autoload from src/ with PSR-4 prefix gcgov\arcgis\. The code is split into two layers:

Namespace Purpose
gcgov\arcgis\sdk\* Generic ArcGIS REST machinery: configuration, token generation, the FeatureService base class (query/add/update/delete/schema operations), the LocatorService base class (geocoding), typed models for service and layer metadata, and typed response models.
gcgov\arcgis\* (root) Garrett County–specific service wrappers bound to specific published services. Each wrapper pairs with a sub-namespace of typed Feature / FeatureProperties / FeatureQuery classes that mirror that layer's schema.

Prebuilt service wrappers:

Class ArcGIS service Layer Notes
\gcgov\arcgis\MajorMinorFeatureService Hosted/Major_and_Minor_Structures/FeatureServer 0 The bridges application's system-of-record layer. When config has development=true, targets Hosted/DEVELOPMENT_Major_and_Minor_Structures instead.
\gcgov\arcgis\BridgesCulvertsFeatureService Hosted/Bridges_and_Culverts/FeatureServer 0 Legacy bridges/culverts inventory layer; used for one-time imports into the bridges application.
\gcgov\arcgis\CenterLinesCulvertsFeatureService Addresses/Garrett_Centerlines/FeatureServer 1 County road centerlines (Maryland SHA schema, uppercase field names). Includes getAllRoadNames().
\gcgov\arcgis\DPUWaterSystemEditorFeatureService Hosted/DPU_Water_System_Editor/FeatureServer 21 layers + 5 tables Department of Public Utilities water system assets (hydrants, valves, meters, mains, boundaries, inspection tables). One typed getAll…Features() method and a LAYER_*/TABLE_* id constant per sublayer and table. When config has development=true, targets Hosted/DEVELOPMENT_DPU_Water_System_Editor instead and transparently translates the LAYER_*/TABLE_* constants to that service's re-sequenced layer ids (0–25).
\gcgov\arcgis\AddressLocator Addresses/Garrett_Address_Locator/GeocodeServer — Address geocoding via findAddressCandidates.

Every model extends andrewsauder\jsonDeserialize\jsonDeserialize, which gives it:

Quick start

All SDK methods throw \GuzzleHttp\Exception\GuzzleException (transport failures) and \andrewsauder\jsonDeserialize\exceptions\jsonDeserializeException (unexpected response shape); wrap calls accordingly:

Configuration and authentication

\gcgov\arcgis\config carries the portal base URL, credentials, and a development flag:

Real-world construction from bridge-api, where connection settings live in the app's environment config:

Reading features

Each service wrapper provides getAllFeatures() — or, for multi-layer services, one getAll…Features() method per sublayer — which queries the layer with f=geojson, where=1=1, and outFields=*, requesting 1,000 records per call and recursing with resultOffset while the response reports exceededTransferLimit. The merged result is an array of typed Feature objects:

Multi-layer services expose one typed method and one layer id constant per sublayer and table. The constants are also how you target a sublayer in edit and schema operations. The constants always hold the production layer ids — in development mode the service translates them to the development copy's ids on every request, so consuming code never branches on environment:

Layers that are searched by attribute also expose a where-filtered variant that pages exactly like getAll…Features() but sends your ArcGIS SQL where clause instead of 1=1 (escape embedded single quotes by doubling them):

A Feature follows the GeoJSON shape:

Editing features

sdk\FeatureService exposes addFeatures(), updateFeatures(), and deleteFeatures(), each accepting an array of Feature objects and an optional layer id (default 0). Internally the SDK converts each GeoJSON-shaped Feature into the ESRI edit format ({ attributes: {...}, geometry: { x, y, spatialReference: { wkid: 4326 } } }) via sdk\AddFeature::fromFeature() / sdk\UpdateFeature::fromFeature(). Features without coordinates serialize with no geometry, making an attribute-only edit.

Add

Check both the response-level error and each per-feature result — this is the pattern bridge-api uses, including capturing the new ESRI ids back onto its own record so future syncs can match:

Update

Fetch existing features, mutate their typed properties, and send them back. updateFeatures() matches on the feature's objectid:

$updateResponse->updateResults contains a per-feature success flag and optional error, exactly like add results.

Delete

Deletion is by object id — each passed feature must have its objectid populated (getObjectId()); features without one are skipped.

Attachments

For layers published with hasAttachments, files can be attached to a feature by object id (POST {layer}/{objectId}/addAttachment) and listed back (GET {layer}/{objectId}/attachments):

addAttachment() streams the file as a multipart upload; the attachment name defaults to the file's base name and the mime type part is omitted when $contentType is null. ArcGIS does not deduplicate attachments — upload with deterministic names and check getAttachmentInfos() first when an operation may run more than once (see the utility-account-lookup-api meter replacement sync).

Managing layer schema (fields and domains)

The FeatureService base class can administer the layer definition through the ArcGIS admin REST endpoint. bridge-api uses this to project its application model onto the GIS layer: it reflects over its own classes and creates/updates one ESRI field per property, including coded-value domains for dropdown-style fields.

Inspect the current schema:

Add or update fields:

Both return a response with success and error. addFeatureLayerFields() additionally returns domainMap entries — when ArcGIS has to rename a requested domain (name collision), createdDomainName differs from originalDomainName, and the caller should persist the created name for future lookups (see bridge-api's gisIntegration::updateFeatureLayerDefinition()).

Service metadata

Both calls cache their result on the service instance; pass forceFetch: true to re-request (for example after changing the schema — updateFeatureLayerFields() does this automatically).

FeatureServerLayer also provides lookup helpers for translating human readable values into stored codes (all name matching is case-insensitive):

Geocoding

\gcgov\arcgis\AddressLocator wraps the county's geocode service. Set any of the standard findAddressCandidates parameters as public properties, then call findAddressCandidates() — every non-null property becomes a query string parameter:

How the bridges application uses this SDK (reference integration)

The bridges asset-management system demonstrates the intended full-stack pattern.

Server side (bridge-api, PHP): MongoDB is the system of record for structure documents; the Major_and_Minor_Structures hosted layer is the GIS projection of that data. Scheduled CLI endpoints keep the two in sync:

  1. Schema sync (/cli/updateFeatureLayerDefinition) — reflects over the application's structure model. Properties tagged with an #[esriField] attribute map to ESRI fields (deriving field name, type, and alias from the PHP property); properties tagged with a category attribute get coded-value domains built from the application's category/type tables. Fields are then created or updated on layer 0 via addFeatureLayerFields() / updateFeatureLayerFields().
  2. Feature sync (/cli/updateGisFeatures) — pulls all features with getAllFeatures(), matches them to Mongo documents by stored esriGlobalId, then: updates matched features (copying application values onto $feature->properties and rounding coordinates to 5 decimals), adds features for unmatched documents (persisting the returned objectId/globalId back to Mongo), and deletes features that no longer have a matching document.
  3. Reference-data pulls — road names and extents are imported from the centerlines layer (CenterLinesCulvertsFeatureService::getAllFeatures()), and the legacy Bridges_and_Culverts layer was imported one-time into Mongo the same way.

Client side (bridge-app, Vue 3 + @arcgis/core ^4.29): the browser never talks to the PHP SDK — it renders the same ArcGIS services directly with the ArcGIS Maps SDK for JavaScript, and plots application data (structure coordinates served by bridge-api from Mongo) as graphics:

The contract that makes the two halves line up:

Adding support for a new feature service

Wrapping another published service is a four-file pattern (see src/MajorMinorFeatureService* for the canonical example):

  1. Service wrapper — src/MyServiceFeatureService.php, extending sdk\FeatureService and hard-coding the service and admin URLs (branch on $config->isDevelopment() if a development copy of the service exists):

  2. Properties — src/MyServiceFeatureService/FeatureProperties.php extending sdk\FeatureProperties, with one nullable typed public property per layer field, named exactly as the field is named on the layer (check getFeatureServerLayer()->fields).

  3. Feature — src/MyServiceFeatureService/Feature.php extending sdk\Feature; type the $properties property to your FeatureProperties, instantiate it in the constructor, and implement getProperties(), getObjectId(), and getGlobalId() against the layer's id fields.

  4. Query — src/MyServiceFeatureService/FeatureQuery.php extending sdk\FeatureQuery, re-declaring $features so the docblock hydrates elements to your Feature class:

The /** @var ... */ docblock on $features is what tells the deserializer which class to hydrate — without it (or with the wrong class name) features will not be typed correctly.

License

MIT — see LICENSE.


All versions of arcgisphpsdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
guzzlehttp/guzzle Version ^7.8
andrewsauder/json-deserialize Version ^3.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 gcgov/arcgisphpsdk contains the following files

Loading the files please wait ...