Download the PHP package oliverbj/cord without Composer

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

Seamless integration to CargoWise One's eAdapter using Laravel

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

Cord offers an expressive, chainable API for interacting with CargoWise One's eAdapter over HTTP.

Table of Contents

Support

Cord currently targets:

Installation

Install the package via Composer:

Publish the config file:

Laravel Boost

If your application uses Laravel Boost, Cord ships package-owned Boost resources so Boost can include Cord guidance automatically.

In the consuming Laravel application:

After updating Cord or Boost itself, refresh generated agent resources with:

Boost discovers these resources from the package automatically, so Cord does not require an extra publish step beyond Boost's normal install and update commands.

Configuration

The published config/cord.php file looks like this:

Set your CargoWise eAdapter credentials in .env:

Usage

Start with a target, call get() before run() for organization, staff, and one-off quote retrievals, then execute the request with run(). By default Cord returns the decoded eAdapter payload as an array. Call toJson() or toXml() before run() when you need serialized output.

Operation Schemas

Cord now exposes AI-facing operation contracts and structured execution helpers.

describe() is registry-backed:

Targets

Cord currently supports these main targets:

Request context

You can scope a request to a specific CargoWise company:

For universal requests, withCompany() also enables Cord to derive a SenderID from the configured eAdapter host plus the company code, for example DEMO1TRNCPH. The default RecipientID is Cord.

If you need to override either value, you can set them explicitly:

Documents / eDocs

Most entities in CargoWise One expose eDocs. Use withDocuments() to retrieve a document collection for the selected target.

When fetching documents you can add filters:

Available filters:

For document lookups that are keyed by a CargoWise module code plus job number instead of a first-class Cord target, use DocManager.

Upload documents

You can upload a document to a CargoWise file with addDocument():

Document uploads are sent as UniversalEvent requests. When withCompany() is provided, Cord places Company, EnterpriseID, and ServerID inside Event > DataContext instead of using top-level interchange identifiers.

Add events

Cord can also push events to jobs:

addEventContext() appends Event > ContextCollection > Context rows.

Structured equivalent:

DocManager

Cord also supports CargoWise DocManager lookups for document collections that are keyed by a module code plus job number.

Fetch documents

Call withCompany() and pass the module code and job number separately. Cord composes the outgoing DataTarget > Key as <MODULE> <JOBNUMBER> for you and sends a UniversalDocumentRequest with Company, EnterpriseID, and ServerID inside DocumentRequest > DataContext.

Structured equivalent:

You can chain the same document filters used by withDocuments() before run() or inspect():

When CargoWise expects multiple distinct <FilterCollection> nodes, call filterCollection() once per collection:

Structured equivalent:

Introspection:

Requirements:

Most used codes

Code Module Sample
BKG Bookings with Quote BKG 12345678
CIV Commercial Invoice CIV ....
CON Consol CON ...
CPY Company CPY ....
ISF Importer Security Filing ISF ....
ORG Organization ORG ABCDEFBYX
QU1 One Off Quote QU1 12345678
RIN Receivable Invoice RIN ...
SHP Shipment SHP 12345678
WKI Work Item WKI 12345678
PIN Payables Invoice 12345678
PCR Payables Credit Note 12345667

Organizations

Cord maps beautifully into the organization module of CargoWise.

Query Organization

Use organization() with one or more criteriaGroup() calls for native organization queries, then call get() before run().

If the caller needs the organization payload as JSON instead of the default array, call toJson() before run():

The type argument can be either Key or Partial. Key is the default.

Partial Match Retrieval

You can retrieve entities by providing field names along with either complete values or partial values using wildcards to filter by. Multiple criteria items can be provided and multiple groups of criteria can be provided.

All items within a criteria group assume an ‘And’ operation, whilst an ‘Or’ operation is performed between each criteria group.

You can define multiple criteria groups. Multiple groups behave like an OR statement:

Unique Key Based Retrieval

This is the retrieval of data by providing a candidate key (unique reference). This message requires that the Code property on the table OrgHeader is a candidate key to work.

If you specify a FieldName that is not a candidate key, a Rejection status will be returned with an appropriate error message.

When using unique key based retrieval, only a single key can be specified. There will only be one Criteria element, as multiple criteria with different unique keys would never return a result. This is because you could never find an Organization with a code of ABC and XYZ

You can define multiple criteria groups. Multiple groups behave like an OR statement:

Create Organization

New organizations are created with organization('CODE')->create(). Supply at least fullName() — all other setters are optional. Multiple addresses and contacts can be chained.

Method Required Description
fullName(string) Organisation display name
isActive(bool) Defaults to true
isConsignee(bool) Organisation role flag
isConsignor(bool) Organisation role flag
isForwarder(bool) Organisation role flag
isAirLine(bool) Organisation role flag
closestPort(string) UNLOCO code for closest port
addAddress(Closure) Repeatable; see address builder below
addContact(Closure) Repeatable; see contact builder below

Note: addAddress() and addContact() use the same builders as the update path. See Add a contact.

Update Organization

Native organization updates are anchored on organization('CODE')->update(). Call update() before any write setter — this mirrors the staff()->update() pattern.

Add an address

Required: code, addressOne, country, city.
Use ->capability($addressType, $isMainAddress) to append an address type. Call it multiple times for multiple capabilities.

Available setters: code, addressOne, addressTwo, country, city, state, postcode, relatedPort, phone, fax, mobile, email, dropModeFCL, dropModeLCL, dropModeAIR, active, capability.

Add a contact

Required: name, email.
Available setters: name, email, active, notifyMode, title, gender, language, phone, mobilePhone, homePhone, attachmentType.

Add EDI communication details

Required: module, purpose, direction, transport, destination, format.
Optional setters: subject, publishMilestones, senderVAN, receiverVAN, filename.

Transfer existing organization data

The transfer helpers copy an existing entity from a source organization payload to a target organization. They still accept a raw array sourced directly from a CargoWise payload:

Schema and structured execution

All organization write operations are registered in the operation registry, so fromStructured() and schema() work the same way as for One-Off Quotes and Staff:

Company

You are able to use Cord to interact with companies in CargoWise.

Query Company

Company queries follow the same native query pattern:

Staff

You can also use Cord to manage Staff records in CargoWise.

Container

Cord supports querying CargoWise container types via the native request pattern.

Query Container

Container queries use GlbContainerType as the criteria entity. Call get() before inspect() or run().

If you already know the container code, container('20GP')->get() preloads the same key criteria group.

Structured container queries work the same way:

Staff

You can also use Cord to manage Staff records in CargoWise.

Query Staff

Staff queries follow the same native criteria-group pattern as organization queries, but use GlbStaff as the criteria entity. Call get() before inspect() or run().

If you already know the staff code, staff('BVO')->get() preloads the same key criteria group for you.

Method introspection:

Create Staff

Staff creation is sent as a native Native request. Company context is required. EnterpriseID and ServerID are derived from the configured url, and CodesMappedToTarget defaults to true. You can override the native context with withEnterprise(), withServer(), or withCodeMapping(false).

Common fluent setters:

Method introspection:

schema() returns a JSON-Schema-style contract with properties, required, nested items, enums, and x-cord metadata for the operation id, resource, and action.

Update Staff

Staff updates are sent as native Native requests with Action="UPDATE".

One Off Quotes

Use Cord to interact with the One-Off Quote module in CargoWise.

Query One-Off Quote

One-off quote retrieval uses the universal shipment request with DataTarget Type="OneOffQuote" and a quote key.

Call withCompany() before run() so Cord can populate the One-Off Quote DataContext with the company, EnterpriseID, ServerID, and the ORP recipient role expected by CargoWise.

One-off quote query introspection:

Create One-Off Quote

One-off quote creation is sent as a universal shipment request with DataTarget Type="OneOffQuote".

Call withCompany() before run() so Cord can populate the create payload with the company, required quote branch(), optional orgRole(), EnterpriseID, ServerID, and any optional eventBranch() / eventDepartment() codes.

The address setters accept either a full nested address builder or a CargoWise organization code string such as ABSDEOSLP.

Structured one-off quote create payloads support the same shortcuts:

One-off quote create requirements:

Optional one-off quote create helpers:

One-off quote introspection:

CargoWise does not support one-off quote updates through eAdapter, so Cord does not publish a one_off_quote.update operation.

Add Document to One-Off Quote

Add a document to an existing one-off quote with addDocument(). This uses UniversalEvent rather than UniversalShipment. Call withCompany() so Cord can populate Event > DataContext with Company, EnterpriseID, and ServerID for the target quote key.

Structured equivalent:

Add Event to One-Off Quote

Add an event to an existing one-off quote with addEvent(). This also uses UniversalEvent. Call withCompany() so Cord can populate Event > DataContext with Company, EnterpriseID, and ServerID for the target quote key.

Structured equivalent:

Multiple Connections

If you need to connect to multiple eAdapters, use withConfig():

Then add the additional connection to config/cord.php:

The configured URL does not have to point directly at the eAdapter itself. It can point to middleware, as long as that middleware forwards the request and returns the eAdapter response. If you want enterprise and server auto-detection for native write requests, the URL should preserve the CargoWise host pattern such as https://demo1trnservices.example.invalid/eAdaptor.

Raw XML

If you already have a complete XML payload and just want Cord to send it with the configured eAdapter credentials and headers, use rawXml():

For raw XML requests, run() returns the full parsed eAdapter envelope instead of only Data. That means Status, ProcessingLog, and Data are all preserved.

inspect() still performs a dry run and returns the outbound XML unchanged:

Response as JSON

If you want the same response payload serialized as JSON, call toJson() before run():

For rawXml() requests, toJson() returns the full response envelope as JSON, including Status, ProcessingLog, and Data:

Response as XML

If you want the original eAdapter response as XML, call toXml() before run():

For rawXml() requests, toXml() returns the full response envelope, including Status and ProcessingLog:

Field Selection

Chain select() before run() on any query to restrict the returned payload to just the fields you need:

select() works across all response types: flat single-record responses, multi-record lists, and universal shipment payloads. It also composes with toJson():

Debugging

Use inspect() to build and inspect the outgoing XML without sending the HTTP request:

Testing

composer test now covers both staff creation and non-collection staff updates.

Manual staff test

For controlled manual testing, Cord includes a local runner script that builds the staff payload and only sends it when you explicitly opt in. By default it creates staff; add --update to send an update instead.

  1. Create a local .env from .env.example and fill in your connection details.
  2. Copy resources/manual/staff-payload.example.php to resources/manual/staff-payload.local.php.
  3. Edit the local payload file with the staff data you want to test.
  4. Run an inspect-only dry run first:

That prints the exact XML and does not send anything.

When you are ready to post the request, run:

To update an existing staff row such as XX0, keep the code in your payload and add --update:

Example local .env:

The runner derives EnterpriseID=XXX and ServerID=TRN from that URL and uses them in the native DataContext.

You can still override the derived native context per run if needed:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of cord with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-simplexml Version *
guzzlehttp/guzzle Version ^7.4
illuminate/http Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
spatie/array-to-xml Version ^3.1
spatie/laravel-package-tools Version ^1.92
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 oliverbj/cord contains the following files

Loading the files please wait ...