Download the PHP package husail/edi-sdk without Composer

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

husail/edi-sdk

Generic PHP SDK for reading, writing and validating fixed-width EDI files.

PHP License Status


๐Ÿ“‹ Requirements


๐Ÿ“ฆ Installation


๐Ÿง  Core concepts

Define the file layout once and reuse it for:

The SDK handles:

Layouts can be defined using:

It also supports complex file structures such as:


๐Ÿ“ Defining a layout

PHP Builder

YAML

line_ending must use single-quoted escape sequences ('\r\n', '\n'). Double quotes cause YAML to interpret the escape before the SDK processes it.

JSON

Same structure as YAML.


๐Ÿ“ Writing a file


๐Ÿ“‚ Reading a file

Without cast defined on the field, the parser returns raw strings. Add cast: int, cast: float or cast: date to the field definition for automatic conversion.


โœ… Validating a file


๐ŸŒณ Sequence nodes

The sequence tree describes how records are ordered and grouped in the file.

Node Factory Description
RecordNode Record::one($layout) Exactly one required record
RecordNode Record::optional($layout) One optional record
ManyNode Record::many($layout) Zero or more records of the same type
GroupNode Group::repeat($identifyBy, $children) Repeatable group of records (e.g. batches)
AmbiguousNode Group::ambiguous($identifyBy, $children) Interleaved record types at the same position

The identifyBy closure receives the raw line and returns the record name it belongs to, or null to close the group.

Example: repeatable batches

Composite identify_by in YAML

Some formats use the same character at a given position for multiple record types. The YAML driver supports composite identify_by rules with multiple match conditions. More specific rules must come first โ€” the first matching rule wins.

Each match supports value (exact equality) and in (list of accepted values). children is optional when identify_by is present โ€” the driver automatically infers a ManyNode for each record declared in the rules, preserving order. If neither children nor identify_by is present, a LayoutException is thrown.


๐Ÿ“‘ Field definition reference

Property Type Description
name string Field key in parser output
pos int Start position, 1-based
len int Length in characters
type alpha\|numeric Determines default padding
const ?string Fixed value โ€” writer ignores input, validator enforces
default ?string Fallback when value is null or empty
required bool Validator emits error when ALPHA field is empty (default: true)
cast ?string Parser cast: int, float, date
decimal_places int Implicit decimal places for numeric values (requires cast: float)
format ?string Date format, required when cast: date (e.g. dmY)
padding_char ?string Overrides default padding char for the type
padding_side left\|right Overrides default padding side for the type

Default padding

Type Char Side
alpha space right
numeric 0 left

required only applies to ALPHA fields. For NUMERIC, zeros are valid values and cannot be distinguished from unfilled fields in a fixed-width format.


โœ”๏ธ Custom validators


โš™๏ธ Custom layout driver

Implement LayoutDriverInterface to load layouts from any source. Your driver is responsible only for parsing the format โ€” the ArrayLayoutMapper handles building the FileLayout from the normalized array.


๐Ÿงช Testing


๐Ÿค Contributing

Contributions, issues and pull requests are welcome. \ If you find a bug or have a suggestion, feel free to open an issue.


๐Ÿ“œ License

Licensed under the MIT License.


All versions of edi-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/yaml Version ^6.0|^7.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 husail/edi-sdk contains the following files

Loading the files please wait ...