Download the PHP package somnambulist/attribute-model without Composer

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

Attribute Model

GitHub Actions Build Status Issues License PHP Version Current Version

A sort-of-kind-of ActiveModel type'ish base for Models that rely on an array of attributes. Includes a type-casting sub-system for casting attributes to values. Extracted from read-models.

The focus is for creating read-only Model representations for use in presentation layers. This library is used by somnambulist/read-models and api-client.

Requirements

Installation

Install using composer, or checkout / pull the files from github.com.

Usage

Extend to a model e.g. User; or implement into a base model and add extra functionality. Use attribute casting if needed before passing attributes into the model.

Built-in Casters

The following casters are built-in and are largely configurable by type or attribute name(s):

Caster Output Comments
AreaCaster Somnambulist\Components\Models\Types\Measure\Area convert a value + unit to an Area value object
CoordinateCaster Somnambulist\Components\Models\Types\Geography\Coordinate convert lat/long/srid strings to value object
DateTimeCaster Somnambulist\Components\Models\Types\DateTime\DateTime convert a date/time in a format to a DateTime object
DistanceCaster Somnambulist\Components\Models\Types\Measure\Distance convert a value + unit to a Distance value object
EnumCaster BackedEnum returns a PHP 8.1 backed enum
EnumerableKeyCaster Somnambulist\Components\Models\AbstractEnumeration returns instantiated enumeration object using the member key; may also be a multiton
EnumerableValueCaster Somnambulist\Components\Models\AbstractEnumeration returns instantiated enumeration object using the member value
ExternalIdentityCaster Somnambulist\Components\Models\Identity\ExternalIdentity decodes a JSON string into an ExternalIdentity value object
JsonArrayCaster array decodes a JSON string into a simple array
JsonCollectionCaster Somnambulist\Collection\MutableCollection decodes a JSON string into a collection object
MoneyCaster Somnambulist\Components\Models\Types\Money\Money convert a value + ISO currency to value object
SimpleValueObjectCaster Somnambulist\Components\Models\AbstractValueObject creates value-objects from a single string value e.g. EmailAddress

Many of the casters accept alternative attribute names for matching and type overrides. Suitable defaults are provided where appropriate (e.g.: json, json_array, json_collection).

More casters can be added by implementing the interface and attaching to the AttributeCaster.

An existing caster can be re-used on another type by calling $caster->extend(<type>, [new, types, here]). The configuration of the caster cannot be changed; it adds extra type keys that the caster will respond to.

Tests

PHPUnit 9+ is used for testing. Run tests via vendor/bin/phpunit.


All versions of attribute-model with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
pragmarx/ia-str Version ^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 somnambulist/attribute-model contains the following files

Loading the files please wait ....